1919$$
2020\gdef\customtextcircled#1{\textcircled{\small#1}}
2121\gdef\formulanumber#1{\,\cdot\cdot\cdot\cdot\cdot\cdot\,\customtextcircled{#1}}
22- \begin{dcases}
23- \begin{alignat*}{3.5}
24- & x_1 - {} & 2 & x_2 + {} & 3 & x_3 = 3 & \formulanumber{1} \\
25- -& x_1 + {} & 3 & x_2 - {} & 2 & x_3 = 1 & \formulanumber{2} \\
26- & x_1 - {} & & x_2 + {} & 6 & x_3 = 11 & \formulanumber{3}
27- \end{alignat*}
28- \end{dcases}
22+ \left\{
23+ \begin{alignat*}{3.5}
24+ & x_1 - {} & 2 & x_2 + {} & 3 & x_3 = 3 & \formulanumber{1} \\
25+ -& x_1 + {} & 3 & x_2 - {} & 2 & x_3 = 1 & \formulanumber{2} \\
26+ & x_1 - {} & & x_2 + {} & 6 & x_3 = 11 & \formulanumber{3}
27+ \end{alignat*}
28+ \right.
2929$$
3030
3131$
4949\gdef\formulanumber#1{\,\cdot\cdot\cdot\cdot\cdot\cdot\,\customtextcircled{#1}}
5050\begin{align*}
5151 2x_2 + 4x_3 &= 12 \\
52- \therefore x_2 + 2x_3 &= 6 \formulanumber{5}
52+ \therefore x_2 + 2x_3 &= 6 \formulanumber{5}
5353\end{align*}
5454$$
5555
5959\customtextcircled{ 4 } ,\customtextcircled{ 5 } $ より、
6060
6161$$
62- \begin{dcases}
63- x_2 = 2 \\
64- x_3 = 2
65- \end{dcases}
62+ \left\{
63+ \begin{align*}
64+ x_2 &= 2 \\
65+ x_3 &= 2
66+ \end{align*}
67+ \right.
6668$$
6769
6870よって、
6971
7072$$
71- \begin{dcases}
72- x_1 = 1 \\
73- x_2 = 2 \\
74- x_3 = 2
75- \end{dcases}
73+ \left\{
74+ \begin{align*}
75+ x_1 &= 1 \\
76+ x_2 &= 2 \\
77+ x_3 &= 2
78+ \end{align*}
79+ \right.
7680$$
7781
7882しかし、このようなアルゴリズムでプログラムを作るのは、難しそうです。
@@ -88,15 +92,15 @@ Gauss の消去法は、前進消去と後退代入の二段階から成りま
8892次のように $n$ 個の未知数 $x_1, x_2, x_3, \dots , x_n$ に対して、$m$ 個の方程式を考えます。
8993
9094$$
91- \begin{dcases}
92- \begin{alignat*}{5}
93- a_{1, 1} & x_1 + {} & a_{1, 2} & x_2 + {} & a_{1, 3} & x_3 + \dots + {} & a_{1, n} & x_n = c_1 \\
94- a_{2, 1} & x_1 + {} & a_{2, 2} & x_2 + {} & a_{2, 3} & x_3 + \dots + {} & a_{2, n} & x_n = c_2 \\
95- a_{3, 1} & x_1 + {} & a_{3, 2} & x_2 + {} & a_{3, 3} & x_3 + \dots + {} & a_{3, n} & x_n = c_3 \\
96- & \cdots\cdot\cdot \\
97- a_{m, 1} & x_1 + {} & a_{m, 2} & x_2 + {} & a_{m, 3} & x_3 + \dots + {} & a_{m, n} & x_n = c_m
98- \end{alignat*}
99- \end{dcases}
95+ \left\{
96+ \begin{alignat*}{5}
97+ a_{1, 1} & x_1 + {} & a_{1, 2} & x_2 + {} & a_{1, 3} & x_3 + \dots + {} & a_{1, n} & x_n = c_1 \\
98+ a_{2, 1} & x_1 + {} & a_{2, 2} & x_2 + {} & a_{2, 3} & x_3 + \dots + {} & a_{2, n} & x_n = c_2 \\
99+ a_{3, 1} & x_1 + {} & a_{3, 2} & x_2 + {} & a_{3, 3} & x_3 + \dots + {} & a_{3, n} & x_n = c_3 \\
100+ & \cdots\cdot\cdot \\
101+ a_{m, 1} & x_1 + {} & a_{m, 2} & x_2 + {} & a_{m, 3} & x_3 + \dots + {} & a_{m, n} & x_n = c_m
102+ \end{alignat*}
103+ \right.
100104$$
101105
102106この方程式系に対して、以下を行ったものは元の方程式系と同値です。
188192これから、作られる方程式系は次のようになりこれははじめの方程式系と同値です。
189193
190194$$
191- \begin{dcases}
192- \begin{alignat*}{4}
193- & x_{j_1} + \dots + { } & b_{1, j_2} & x_{j_2} + \dots + { } & b_{1, j_3} & x_{j_3} + \dots + { } & b_{1, n} & x_n = d_1 \\
194- 0 & x_{j_1} + \dots + { } & & x_{j_2} + \dots + { } & b_{2, j_3} & x_{j_3} + \dots + { } & b_{2, n} & x_n = d_2 \\
195- 0 & x_{j_1} + \dots + { } & 0 & x_{j_2} + \dots + { } & & x_{j_3} + \dots + { } & b_{3, n} & x_n = d_3 \\
196- & \dots \\
197- 0 & x_{j_1} + \dots + { } & 0 & x_{j_2} + \dots + { } & 0 & x_{j_3} + \dots + { } & & x_n = d_l \\
198- 0 & x_{j_1} + \dots + { } & 0 & x_{j_2} + \dots + { } & 0 & x_{j_3} + \dots + { } & 0 & x_n = d_{l + 1} \\
199- & \dots \\
200- 0 & x_{j_1} + \dots + { } & 0 & x_{j_2} + \dots + { } & 0 & x_{j_3} + \dots + { } & 0 & x_n = d_m \\
201- \end{alignat*}
202- \end{dcases}
195+ \left\{
196+ \begin{alignat*}{4}
197+ & x_{j_1} + \dots + { } & b_{1, j_2} & x_{j_2} + \dots + { } & b_{1, j_3} & x_{j_3} + \dots + { } & b_{1, n} & x_n = d_1 \\
198+ 0 & x_{j_1} + \dots + { } & & x_{j_2} + \dots + { } & b_{2, j_3} & x_{j_3} + \dots + { } & b_{2, n} & x_n = d_2 \\
199+ 0 & x_{j_1} + \dots + { } & 0 & x_{j_2} + \dots + { } & & x_{j_3} + \dots + { } & b_{3, n} & x_n = d_3 \\
200+ & \dots \\
201+ 0 & x_{j_1} + \dots + { } & 0 & x_{j_2} + \dots + { } & 0 & x_{j_3} + \dots + { } & & x_n = d_l \\
202+ 0 & x_{j_1} + \dots + { } & 0 & x_{j_2} + \dots + { } & 0 & x_{j_3} + \dots + { } & 0 & x_n = d_{l + 1} \\
203+ & \dots \\
204+ 0 & x_{j_1} + \dots + { } & 0 & x_{j_2} + \dots + { } & 0 & x_{j_3} + \dots + { } & 0 & x_n = d_m \\
205+ \end{alignat*}
206+ \right.
203207$$
204208
205209これで $x_n$ から順番に求めていくことで連立方程式を解くことができます。
208212Gauss の消去法を次の方程式系について行うと、以下のようになります。
209213
210214$$
211- \begin{dcases}
212- \begin{alignat*}{3.5}
213- & x_1 - { } & 2 & x_2 + { } & 3 & x_3 = 3 \\
214- -& x_1 + { } & 3 & x_2 - { } & 2 & x_3 = 1 \\
215- & x_1 - { } & & x_2 + { } & 6 & x_3 = 11
216- \end{alignat*}
217- \end{dcases}
215+ \left\{
216+ \begin{alignat*}{3.5}
217+ & x_1 - { } & 2 & x_2 + { } & 3 & x_3 = 3 \\
218+ -& x_1 + { } & 3 & x_2 - { } & 2 & x_3 = 1 \\
219+ & x_1 - { } & & x_2 + { } & 6 & x_3 = 11
220+ \end{alignat*}
221+ \right.
218222$$
219223
220224まずは、前進消去を行います。
268272次に、連立方程式に戻して後退代入を行っていきます。
269273
270274$$
271- \begin{dcases}
272- \begin{alignat*}{3}
273- x_1 - 2 & x_2 + { } & 3 & x_3 & { } = { } & 3 \\
274- & x_2 + { } & & x_3 & { } = { } & 4 \\
275- & & & x_3 & { } = { } & 2
276- \end{alignat*}
277- \end{dcases} \\
278- \therefore
279- \begin{dcases}
280- \begin{alignat*}{3}
281- x_1 - 2 & x_2 & & & { } = { } & 3 - 3\times 2 = -3 \\
282- & x_2 & & & { } = { } & 4 - 2 = 2 \\
283- & & & x_3 & { } = { } & 2
284- \end{alignat*}
285- \end{dcases} \\
275+ \left\{
276+ \begin{alignat*}{3}
277+ x_1 - 2 & x_2 + { } & 3 & x_3 & { } = { } & 3 \\
278+ & x_2 + { } & & x_3 & { } = { } & 4 \\
279+ & & & x_3 & { } = { } & 2
280+ \end{alignat*}
281+ \right. \\
286282\therefore
287- \begin{dcases}
288- \begin{alignat*}{3}
289- x_1 & & & & { } = { } & -3 + 2 \times 2 = 1 \\
290- & x_2 & & & { } = { } & 2 \\
283+ \left\{
284+ \begin{alignat*}{3}
285+ x_1 - 2 & x_2 & & & { } = { } & 3 - 3 \times 2 = -3 \\
286+ & x_2 & & & { } = { } & 4 - 2 = 2 \\
291287 & & & x_3 & { } = { } & 2
292- \end{alignat*}
293- \end{dcases} \\
288+ \end{alignat*}
289+ \right. \\
290+ \therefore
291+ \left\{
292+ \begin{alignat*}{3}
293+ x_1 & & & & { } = { } & -3 + 2\times 2 = 1 \\
294+ & x_2 & & & { } = { } & 2 \\
295+ & & & x_3 & { } = { } & 2
296+ \end{alignat*}
297+ \right. \\
294298\therefore
295- \begin{dcases}
296- \begin{align*}
297- x_1 &= 1\\
298- x_2 &= 2\\
299- x_3 &= 2
300- \end{align*}
301- \end{dcases}
299+ \left\{
300+ \begin{align*}
301+ x_1 &= 1\\
302+ x_2 &= 2\\
303+ x_3 &= 2
304+ \end{align*}
305+ \right.
302306$$
303307
304308Gauss の消去法を使えば、このようにシステマティックに連立方程式を解けます。
330334これから、作られる方程式系は次のようになりこれは元の方程式系と同値です。
331335
332336$$
333- \begin{dcases}
334- \begin{alignat*}{4}
335- & x_{j_1} + \dots + { } & 0 & x_{j_2} + \dots + { } & 0 & x_{j_3} + \dots + { } & 0 & x_n = d_1 \\
336- 0 & x_{j_1} + \dots + { } & & x_{j_2} + \dots + { } & 0 & x_{j_3} + \dots + { } & 0 & x_n = d_2 \\
337- 0 & x_{j_1} + \dots + { } & 0 & x_{j_2} + \dots + { } & & x_{j_3} + \dots + { } & 0 & x_n = d_3 \\
338- & \dots \\
339- 0 & x_{j_1} + \dots + { } & 0 & x_{j_2} + \dots + { } & 0 & x_{j_3} + \dots + { } & & x_n = d_l \\
340- 0 & x_{j_1} + \dots + { } & 0 & x_{j_2} + \dots + { } & 0 & x_{j_3} + \dots + { } & 0 & x_n = d_{l + 1} \\
341- & \dots \\
342- 0 & x_{j_1} + \dots + { } & 0 & x_{j_2} + \dots + { } & 0 & x_{j_3} + \dots + { } & 0 & x_n = d_m \\
343- \end{alignat*}
344- \end{dcases}
337+ \left\{
338+ \begin{alignat*}{4}
339+ & x_{j_1} + \dots + { } & 0 & x_{j_2} + \dots + { } & 0 & x_{j_3} + \dots + { } & 0 & x_n = d_1 \\
340+ 0 & x_{j_1} + \dots + { } & & x_{j_2} + \dots + { } & 0 & x_{j_3} + \dots + { } & 0 & x_n = d_2 \\
341+ 0 & x_{j_1} + \dots + { } & 0 & x_{j_2} + \dots + { } & & x_{j_3} + \dots + { } & 0 & x_n = d_3 \\
342+ & \dots \\
343+ 0 & x_{j_1} + \dots + { } & 0 & x_{j_2} + \dots + { } & 0 & x_{j_3} + \dots + { } & & x_n = d_l \\
344+ 0 & x_{j_1} + \dots + { } & 0 & x_{j_2} + \dots + { } & 0 & x_{j_3} + \dots + { } & 0 & x_n = d_{l + 1} \\
345+ & \dots \\
346+ 0 & x_{j_1} + \dots + { } & 0 & x_{j_2} + \dots + { } & 0 & x_{j_3} + \dots + { } & 0 & x_n = d_m \\
347+ \end{alignat*}
348+ \right.
345349$$
346350
347351これで連立方程式を解くことができました。
350354これを次の方程式系について行うと、以下のようになります。
351355
352356$$
353- \begin{dcases}
354- \begin{alignat*}{3.5}
355- & x_1 - { } & 2 & x_2 + { } & 3 & x_3 = 3 \\
356- -& x_1 + { } & 3 & x_2 - { } & 2 & x_3 = 1 \\
357- & x_1 - { } & & x_2 + { } & 6 & x_3 = 11
358- \end{alignat*}
359- \end{dcases}
357+ \left\{
358+ \begin{alignat*}{3.5}
359+ & x_1 - { } & 2 & x_2 + { } & 3 & x_3 = 3 \\
360+ -& x_1 + { } & 3 & x_2 - { } & 2 & x_3 = 1 \\
361+ & x_1 - { } & & x_2 + { } & 6 & x_3 = 11
362+ \end{alignat*}
363+ \right.
360364$$
361365
362366$$
430434$$
431435
432436$$
433- \begin{dcases}
434- \begin{alignat*}{4}
435- & x_1 + { } & 0 & x_2 + { } & 0 & x_3 & & = 1 \\
436- 0 & x_1 + { } & & x_2 + { } & 0 & x_3 & & = 2 \\
437- 0 & x_1 + { } & 0 & x_2 + { } & & x_3 & & = 2
438- \end{alignat*}
439- \end{dcases} \\
437+ \left\{
438+ \begin{alignat*}{4}
439+ & x_1 + { } & 0 & x_2 + { } & 0 & x_3 & & = 1 \\
440+ 0 & x_1 + { } & & x_2 + { } & 0 & x_3 & & = 2 \\
441+ 0 & x_1 + { } & 0 & x_2 + { } & & x_3 & & = 2
442+ \end{alignat*}
443+ \right. \\
440444\therefore
441- \begin{dcases}
442- \begin{align*}
443- x_1 &= 1 \\
444- x_2 &= 2 \\
445- x_3 &= 2
446- \end{align*}
447- \end{dcases}
445+ \left\{
446+ \begin{align*}
447+ x_1 &= 1 \\
448+ x_2 &= 2 \\
449+ x_3 &= 2
450+ \end{align*}
451+ \right.
448452$$
449453
450454:::
@@ -473,13 +477,13 @@ $x_n$ は $d_n$ になります。求まった $x_n$ をそれよりも上の式
473477次のような連立方程式を解こうとすると、次のようなエラーが出てしまいます。
474478
475479$$
476- \begin{dcases}
477- \begin{alignat*}{3.5}
478- & & -2 & x_2 + {} & 3 & x_3 = 2 \\
479- -& x_1 + {} & 3 & x_2 - {} & 2 & x_3 = 1 \\
480- & x_1 - {} & & x_2 + {} & 6 & x_3 = 11
481- \end{alignat*}
482- \end{dcases}
480+ \left\{
481+ \begin{alignat*}{3.5}
482+ & & -2 & x_2 + {} & 3 & x_3 = 2 \\
483+ -& x_1 + {} & 3 & x_2 - {} & 2 & x_3 = 1 \\
484+ & x_1 - {} & & x_2 + {} & 6 & x_3 = 11
485+ \end{alignat*}
486+ \right.
483487$$
484488
485489<ViewSource path = " /gaussian-elimination/gaussian_elimination_error.ipynb" />
0 commit comments