2-4
다음 행렬 A, B에 대해 AB=BA가 성립하도록 a, b, c, d를 계산하세요.
a,b,c,d=symbols("a b c d")
A=Matrix([[a, b],[c,d]])
B=Matrix([[1, 2], [3, 4]])
ab=A*B
ab
$\left[\begin{matrix}a + 3 b & 2 a + 4 b\\c + 3 d & 2 c + 4 d\end{matrix}\right]$
ba=B*A
ba
$\left[\begin{matrix}a + 2 c & b + 2 d\\3 a + 4 c & 3 b + 4 d\end{matrix}\right]$
Eq(ab,ba)
$\left[\begin{matrix}a + 3 b & 2 a + 4 b\\c + 3 d & 2 c + 4 d\end{matrix}\right] = \left[\begin{matrix}a + 2 c & b + 2 d\\3 a + 4 c & 3 b + 4 d\end{matrix}\right]$
solve(Eq(ab,ba))
{a: -c + d, b: 2*c/3}
A=Matrix([[a, b],[c,d]])
B=Matrix([[1, 2], [3, 4]])
ab=A*B
ab
$\left[\begin{matrix}a + 3 b & 2 a + 4 b\\c + 3 d & 2 c + 4 d\end{matrix}\right]$
ba=B*A
ba
$\left[\begin{matrix}a + 2 c & b + 2 d\\3 a + 4 c & 3 b + 4 d\end{matrix}\right]$
Eq(ab,ba)
$\left[\begin{matrix}a + 3 b & 2 a + 4 b\\c + 3 d & 2 c + 4 d\end{matrix}\right] = \left[\begin{matrix}a + 2 c & b + 2 d\\3 a + 4 c & 3 b + 4 d\end{matrix}\right]$
solve(Eq(ab,ba))
{a: -c + d, b: 2*c/3}
2-11
2$\times$2 정방행렬이 가역행렬이기 위해서는 다른 동일차원의 행렬과의 곱으로 항등행렬이 존제해야 합니다. 즉, 다음이 성립해야 합니다.
$\left[\begin{matrix}a&b\\c&d\end{matrix}\right] \left[\begin{matrix}x&y\\z&w\end{matrix}\right]=\left[\begin{matrix}1&0\\0&1\end{matrix}\right]$
위 선형 결합의 선형독립이 성립하기 위해서는 확대행렬의 rref에서 해의 존재를 보여야 합니다.
a,b,c,d,x,y,z,w=symbols("a,b,c,d,x,y,z,w")
A=Matrix([[a, b],[c,d]])
B=Matrix([[x, y], [z, w]])
I2=eye(2)
A
$\left[\begin{matrix}a & b\\c & d\end{matrix}\right]$
I2
$\left[\begin{matrix}1 & 0\\0 & 1\end{matrix}\right]$
au=A.row_join(I2)
au
$\left[\begin{matrix}a & b & 1 & 0\\c & d & 0 & 1\end{matrix}\right]$
au.rref()
(Matrix([[1, 0, d/(a*d - b*c), -b/(a*d - b*c)],
[0, 1, -c/(a*d - b*c), a/(a*d - b*c)]]),
(0, 1))
A=Matrix([[a, b],[c,d]])
B=Matrix([[x, y], [z, w]])
I2=eye(2)
A
$\left[\begin{matrix}a & b\\c & d\end{matrix}\right]$
I2
$\left[\begin{matrix}1 & 0\\0 & 1\end{matrix}\right]$
au=A.row_join(I2)
au
$\left[\begin{matrix}a & b & 1 & 0\\c & d & 0 & 1\end{matrix}\right]$
au.rref()
(Matrix([[1, 0, d/(a*d - b*c), -b/(a*d - b*c)],
[0, 1, -c/(a*d - b*c), a/(a*d - b*c)]]),
(0, 1))
위 결과는 다음과 같이 정리되므로 역행렬이 존재하기 위해서는 $ad-bc \neq 0$ 이어야 합니다.
$\begin{align}x&=\frac{d}{(ad - bc)}\\w&=\frac{a}{(ad - bc)} \end{align}$
2_12
다음 선형시스템의 해?
2x1 + 5x2 − 8x3 + 2x4 + 2x5 | = | 0 |
6x1 + 2x2 − 10x3 + 6x4 + 8x5 | = | 6 |
3x1 + 6x2 + 2x3 + 3x4 + 5x5 | = | 6 |
3x1 + x2 − 5x3 + 2x4 + 2x5 | = | 3 |
6x1 + 7x2 − 3x3 + 6x4 + 9x5 | = | 9 |
A=Matrix([[2,5,-8,2,2],[6,2,-10,6,8],[3,6,2,3,5],[3,1,-5,2,2],[6,7,-3,6,9]])
C=Matrix(5, 1, [0,6,6,3,9])
A
$\left[\begin{matrix}2 & 5 & -8 & 2 & 2\\6 & 2 & -10 & 6 & 8\\3 & 6 & 2 & 3 & 5\\3 & 1 & -5 & 2 & 2\\6 & 7 & -3 & 6 & 9\end{matrix}\right]$
C
$\left[\begin{matrix}0\\6\\6\\3\\9\end{matrix}\right]$
au=A.row_join(C)
au
$\left[\begin{matrix}2 & 5 & -8 & 2 & 2 & 0\\6 & 2 & -10 & 6 & 8 & 6\\3 & 6 & 2 & 3 & 5 & 6\\3 & 1 & -5 & 2 & 2 & 3\\6 & 7 & -3 & 6 & 9 & 9\end{matrix}\right]$
au.rref()
(Matrix([[1, 0, 0, 0, -3/7, 12/7],
[0, 1, 0, 0, 0, 0],
[0, 0, 1, 0, 1/7, 3/7],
[0, 0, 0, 1, 2, 0],
[0, 0, 0, 0, 0, 0]]),
(0, 1, 2, 3))
C=Matrix(5, 1, [0,6,6,3,9])
A
$\left[\begin{matrix}2 & 5 & -8 & 2 & 2\\6 & 2 & -10 & 6 & 8\\3 & 6 & 2 & 3 & 5\\3 & 1 & -5 & 2 & 2\\6 & 7 & -3 & 6 & 9\end{matrix}\right]$
C
$\left[\begin{matrix}0\\6\\6\\3\\9\end{matrix}\right]$
au=A.row_join(C)
au
$\left[\begin{matrix}2 & 5 & -8 & 2 & 2 & 0\\6 & 2 & -10 & 6 & 8 & 6\\3 & 6 & 2 & 3 & 5 & 6\\3 & 1 & -5 & 2 & 2 & 3\\6 & 7 & -3 & 6 & 9 & 9\end{matrix}\right]$
au.rref()
(Matrix([[1, 0, 0, 0, -3/7, 12/7],
[0, 1, 0, 0, 0, 0],
[0, 0, 1, 0, 1/7, 3/7],
[0, 0, 0, 1, 2, 0],
[0, 0, 0, 0, 0, 0]]),
(0, 1, 2, 3))
위 결과를 정리하면 다음과 같습니다.
$\begin{align}x_1&=\frac{3}{7}x_5+\frac{12}{7}\\
x_2&=0\\x_3&=-\frac{1}{7}x_5+\frac{3}{7}\\x_4&=-2x_5\end{align}$
댓글 없음:
댓글 쓰기