diff --git a/docs/02algorithms/10gaussian-elimination/index.mdx b/docs/02algorithms/10gaussian-elimination/index.mdx index 2ba8153c1..0942cbed3 100644 --- a/docs/02algorithms/10gaussian-elimination/index.mdx +++ b/docs/02algorithms/10gaussian-elimination/index.mdx @@ -19,13 +19,13 @@ $$ $$ \gdef\customtextcircled#1{\textcircled{\small#1}} \gdef\formulanumber#1{\,\cdot\cdot\cdot\cdot\cdot\cdot\,\customtextcircled{#1}} -\begin{dcases} - \begin{alignat*}{3.5} - & x_1 - {} & 2 & x_2 + {} & 3 & x_3 = 3 & \formulanumber{1} \\ - -& x_1 + {} & 3 & x_2 - {} & 2 & x_3 = 1 & \formulanumber{2} \\ - & x_1 - {} & & x_2 + {} & 6 & x_3 = 11 & \formulanumber{3} - \end{alignat*} -\end{dcases} +\left\{ +\begin{alignat*}{3.5} + & x_1 - {} & 2 & x_2 + {} & 3 & x_3 = 3 & \formulanumber{1} \\ + -& x_1 + {} & 3 & x_2 - {} & 2 & x_3 = 1 & \formulanumber{2} \\ + & x_1 - {} & & x_2 + {} & 6 & x_3 = 11 & \formulanumber{3} +\end{alignat*} +\right. $$ $ @@ -49,7 +49,7 @@ $$ \gdef\formulanumber#1{\,\cdot\cdot\cdot\cdot\cdot\cdot\,\customtextcircled{#1}} \begin{align*} 2x_2 + 4x_3 &= 12 \\ - \therefore x_2 + 2x_3 &= 6 \formulanumber{5} + \therefore x_2 + 2x_3 &= 6 \formulanumber{5} \end{align*} $$ @@ -59,20 +59,24 @@ $ \customtextcircled{4},\customtextcircled{5}$ より、 $$ -\begin{dcases} - x_2 = 2 \\ - x_3 = 2 -\end{dcases} +\left\{ +\begin{align*} + x_2 &= 2 \\ + x_3 &= 2 +\end{align*} +\right. $$ よって、 $$ -\begin{dcases} - x_1 = 1 \\ - x_2 = 2 \\ - x_3 = 2 -\end{dcases} +\left\{ +\begin{align*} + x_1 &= 1 \\ + x_2 &= 2 \\ + x_3 &= 2 +\end{align*} +\right. $$ しかし、このようなアルゴリズムでプログラムを作るのは、難しそうです。 @@ -88,15 +92,15 @@ Gauss の消去法は、前進消去と後退代入の二段階から成りま 次のように $n$ 個の未知数 $x_1, x_2, x_3, \dots , x_n$ に対して、$m$ 個の方程式を考えます。 $$ -\begin{dcases} - \begin{alignat*}{5} - a_{1, 1} & x_1 + {} & a_{1, 2} & x_2 + {} & a_{1, 3} & x_3 + \dots + {} & a_{1, n} & x_n = c_1 \\ - a_{2, 1} & x_1 + {} & a_{2, 2} & x_2 + {} & a_{2, 3} & x_3 + \dots + {} & a_{2, n} & x_n = c_2 \\ - a_{3, 1} & x_1 + {} & a_{3, 2} & x_2 + {} & a_{3, 3} & x_3 + \dots + {} & a_{3, n} & x_n = c_3 \\ - & \cdots\cdot\cdot \\ - a_{m, 1} & x_1 + {} & a_{m, 2} & x_2 + {} & a_{m, 3} & x_3 + \dots + {} & a_{m, n} & x_n = c_m - \end{alignat*} -\end{dcases} +\left\{ +\begin{alignat*}{5} + a_{1, 1} & x_1 + {} & a_{1, 2} & x_2 + {} & a_{1, 3} & x_3 + \dots + {} & a_{1, n} & x_n = c_1 \\ + a_{2, 1} & x_1 + {} & a_{2, 2} & x_2 + {} & a_{2, 3} & x_3 + \dots + {} & a_{2, n} & x_n = c_2 \\ + a_{3, 1} & x_1 + {} & a_{3, 2} & x_2 + {} & a_{3, 3} & x_3 + \dots + {} & a_{3, n} & x_n = c_3 \\ + & \cdots\cdot\cdot \\ + a_{m, 1} & x_1 + {} & a_{m, 2} & x_2 + {} & a_{m, 3} & x_3 + \dots + {} & a_{m, n} & x_n = c_m +\end{alignat*} +\right. $$ この方程式系に対して、以下を行ったものは元の方程式系と同値です。 @@ -188,18 +192,18 @@ $$ これから、作られる方程式系は次のようになりこれははじめの方程式系と同値です。 $$ -\begin{dcases} - \begin{alignat*}{4} - & 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 \\ - 0 & x_{j_1} + \dots + {} & & x_{j_2} + \dots + {} & b_{2, j_3} & x_{j_3} + \dots + {} & b_{2, n} & x_n = d_2 \\ - 0 & x_{j_1} + \dots + {} & 0 & x_{j_2} + \dots + {} & & x_{j_3} + \dots + {} & b_{3, n} & x_n = d_3 \\ - & \dots \\ - 0 & x_{j_1} + \dots + {} & 0 & x_{j_2} + \dots + {} & 0 & x_{j_3} + \dots + {} & & x_n = d_l \\ - 0 & x_{j_1} + \dots + {} & 0 & x_{j_2} + \dots + {} & 0 & x_{j_3} + \dots + {} & 0 & x_n = d_{l + 1} \\ - & \dots \\ - 0 & x_{j_1} + \dots + {} & 0 & x_{j_2} + \dots + {} & 0 & x_{j_3} + \dots + {} & 0 & x_n = d_m \\ - \end{alignat*} -\end{dcases} +\left\{ +\begin{alignat*}{4} + & 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 \\ + 0 & x_{j_1} + \dots + {} & & x_{j_2} + \dots + {} & b_{2, j_3} & x_{j_3} + \dots + {} & b_{2, n} & x_n = d_2 \\ + 0 & x_{j_1} + \dots + {} & 0 & x_{j_2} + \dots + {} & & x_{j_3} + \dots + {} & b_{3, n} & x_n = d_3 \\ + & \dots \\ + 0 & x_{j_1} + \dots + {} & 0 & x_{j_2} + \dots + {} & 0 & x_{j_3} + \dots + {} & & x_n = d_l \\ + 0 & x_{j_1} + \dots + {} & 0 & x_{j_2} + \dots + {} & 0 & x_{j_3} + \dots + {} & 0 & x_n = d_{l + 1} \\ + & \dots \\ + 0 & x_{j_1} + \dots + {} & 0 & x_{j_2} + \dots + {} & 0 & x_{j_3} + \dots + {} & 0 & x_n = d_m \\ +\end{alignat*} +\right. $$ これで $x_n$ から順番に求めていくことで連立方程式を解くことができます。 @@ -208,13 +212,13 @@ $$ Gauss の消去法を次の方程式系について行うと、以下のようになります。 $$ -\begin{dcases} - \begin{alignat*}{3.5} - & x_1 - {} & 2 & x_2 + {} & 3 & x_3 = 3 \\ - -& x_1 + {} & 3 & x_2 - {} & 2 & x_3 = 1 \\ - & x_1 - {} & & x_2 + {} & 6 & x_3 = 11 - \end{alignat*} -\end{dcases} +\left\{ +\begin{alignat*}{3.5} + & x_1 - {} & 2 & x_2 + {} & 3 & x_3 = 3 \\ + -& x_1 + {} & 3 & x_2 - {} & 2 & x_3 = 1 \\ + & x_1 - {} & & x_2 + {} & 6 & x_3 = 11 +\end{alignat*} +\right. $$ まずは、前進消去を行います。 @@ -268,37 +272,37 @@ $$ 次に、連立方程式に戻して後退代入を行っていきます。 $$ -\begin{dcases} - \begin{alignat*}{3} - x_1 - 2 & x_2 + {} & 3 & x_3 & {} = {} & 3 \\ - & x_2 + {} & & x_3 & {} = {} & 4 \\ - & & & x_3 & {} = {} & 2 - \end{alignat*} -\end{dcases} \\ -\therefore -\begin{dcases} - \begin{alignat*}{3} - x_1 - 2 & x_2 & & & {} = {} & 3 - 3\times 2 = -3 \\ - & x_2 & & & {} = {} & 4 - 2 = 2 \\ - & & & x_3 & {} = {} & 2 - \end{alignat*} -\end{dcases} \\ +\left\{ +\begin{alignat*}{3} + x_1 - 2 & x_2 + {} & 3 & x_3 & {} = {} & 3 \\ + & x_2 + {} & & x_3 & {} = {} & 4 \\ + & & & x_3 & {} = {} & 2 +\end{alignat*} +\right. \\ \therefore -\begin{dcases} - \begin{alignat*}{3} - x_1 & & & & {} = {} & -3 + 2\times 2 = 1 \\ - & x_2 & & & {} = {} & 2 \\ +\left\{ +\begin{alignat*}{3} + x_1 - 2 & x_2 & & & {} = {} & 3 - 3\times 2 = -3 \\ + & x_2 & & & {} = {} & 4 - 2 = 2 \\ & & & x_3 & {} = {} & 2 - \end{alignat*} -\end{dcases} \\ +\end{alignat*} +\right. \\ +\therefore +\left\{ +\begin{alignat*}{3} + x_1 & & & & {} = {} & -3 + 2\times 2 = 1 \\ + & x_2 & & & {} = {} & 2 \\ + & & & x_3 & {} = {} & 2 +\end{alignat*} +\right. \\ \therefore -\begin{dcases} - \begin{align*} - x_1 &= 1\\ - x_2 &= 2\\ - x_3 &= 2 - \end{align*} -\end{dcases} +\left\{ +\begin{align*} + x_1 &= 1\\ + x_2 &= 2\\ + x_3 &= 2 +\end{align*} +\right. $$ Gauss の消去法を使えば、このようにシステマティックに連立方程式を解けます。 @@ -330,18 +334,18 @@ $$ これから、作られる方程式系は次のようになりこれは元の方程式系と同値です。 $$ -\begin{dcases} - \begin{alignat*}{4} - & x_{j_1} + \dots + {} & 0 & x_{j_2} + \dots + {} & 0 & x_{j_3} + \dots + {} & 0 & x_n = d_1 \\ - 0 & x_{j_1} + \dots + {} & & x_{j_2} + \dots + {} & 0 & x_{j_3} + \dots + {} & 0 & x_n = d_2 \\ - 0 & x_{j_1} + \dots + {} & 0 & x_{j_2} + \dots + {} & & x_{j_3} + \dots + {} & 0 & x_n = d_3 \\ - & \dots \\ - 0 & x_{j_1} + \dots + {} & 0 & x_{j_2} + \dots + {} & 0 & x_{j_3} + \dots + {} & & x_n = d_l \\ - 0 & x_{j_1} + \dots + {} & 0 & x_{j_2} + \dots + {} & 0 & x_{j_3} + \dots + {} & 0 & x_n = d_{l + 1} \\ - & \dots \\ - 0 & x_{j_1} + \dots + {} & 0 & x_{j_2} + \dots + {} & 0 & x_{j_3} + \dots + {} & 0 & x_n = d_m \\ - \end{alignat*} -\end{dcases} +\left\{ +\begin{alignat*}{4} + & x_{j_1} + \dots + {} & 0 & x_{j_2} + \dots + {} & 0 & x_{j_3} + \dots + {} & 0 & x_n = d_1 \\ + 0 & x_{j_1} + \dots + {} & & x_{j_2} + \dots + {} & 0 & x_{j_3} + \dots + {} & 0 & x_n = d_2 \\ + 0 & x_{j_1} + \dots + {} & 0 & x_{j_2} + \dots + {} & & x_{j_3} + \dots + {} & 0 & x_n = d_3 \\ + & \dots \\ + 0 & x_{j_1} + \dots + {} & 0 & x_{j_2} + \dots + {} & 0 & x_{j_3} + \dots + {} & & x_n = d_l \\ + 0 & x_{j_1} + \dots + {} & 0 & x_{j_2} + \dots + {} & 0 & x_{j_3} + \dots + {} & 0 & x_n = d_{l + 1} \\ + & \dots \\ + 0 & x_{j_1} + \dots + {} & 0 & x_{j_2} + \dots + {} & 0 & x_{j_3} + \dots + {} & 0 & x_n = d_m \\ +\end{alignat*} +\right. $$ これで連立方程式を解くことができました。 @@ -350,13 +354,13 @@ $$ これを次の方程式系について行うと、以下のようになります。 $$ -\begin{dcases} - \begin{alignat*}{3.5} - & x_1 - {} & 2 & x_2 + {} & 3 & x_3 = 3 \\ - -& x_1 + {} & 3 & x_2 - {} & 2 & x_3 = 1 \\ - & x_1 - {} & & x_2 + {} & 6 & x_3 = 11 - \end{alignat*} -\end{dcases} +\left\{ +\begin{alignat*}{3.5} + & x_1 - {} & 2 & x_2 + {} & 3 & x_3 = 3 \\ + -& x_1 + {} & 3 & x_2 - {} & 2 & x_3 = 1 \\ + & x_1 - {} & & x_2 + {} & 6 & x_3 = 11 +\end{alignat*} +\right. $$ $$ @@ -430,21 +434,21 @@ $$ $$ $$ -\begin{dcases} - \begin{alignat*}{4} - & x_1 + {} & 0 & x_2 + {} & 0 & x_3 & & = 1 \\ - 0 & x_1 + {} & & x_2 + {} & 0 & x_3 & & = 2 \\ - 0 & x_1 + {} & 0 & x_2 + {} & & x_3 & & = 2 - \end{alignat*} -\end{dcases} \\ +\left\{ +\begin{alignat*}{4} + & x_1 + {} & 0 & x_2 + {} & 0 & x_3 & & = 1 \\ + 0 & x_1 + {} & & x_2 + {} & 0 & x_3 & & = 2 \\ + 0 & x_1 + {} & 0 & x_2 + {} & & x_3 & & = 2 +\end{alignat*} +\right. \\ \therefore -\begin{dcases} - \begin{align*} - x_1 &= 1 \\ - x_2 &= 2 \\ - x_3 &= 2 - \end{align*} -\end{dcases} +\left\{ +\begin{align*} + x_1 &= 1 \\ + x_2 &= 2 \\ + x_3 &= 2 +\end{align*} +\right. $$ ::: @@ -473,13 +477,13 @@ $x_n$ は $d_n$ になります。求まった $x_n$ をそれよりも上の式 次のような連立方程式を解こうとすると、次のようなエラーが出てしまいます。 $$ -\begin{dcases} - \begin{alignat*}{3.5} - & & -2 & x_2 + {} & 3 & x_3 = 2 \\ - -& x_1 + {} & 3 & x_2 - {} & 2 & x_3 = 1 \\ - & x_1 - {} & & x_2 + {} & 6 & x_3 = 11 - \end{alignat*} -\end{dcases} +\left\{ +\begin{alignat*}{3.5} + & & -2 & x_2 + {} & 3 & x_3 = 2 \\ + -& x_1 + {} & 3 & x_2 - {} & 2 & x_3 = 1 \\ + & x_1 - {} & & x_2 + {} & 6 & x_3 = 11 +\end{alignat*} +\right. $$