Solving matrix equation $AX = B$

1.7k Views Asked by At

I want to solve the matrix equation $AX = B$, where the matrix $A$ and $B$ are given as follows

$A = \begin{bmatrix} 0.1375 & 0.0737 & 0.1380 & 0.1169 & 0.1166 \\ 0.0926 & 0.0707 & 0.0957 & 0.0873 & 0.0733 \\ 0.0767 & 0.0642 & 0.0810 & 0.0766 & 0.0599 \\ 0.1593 & 0.1020 & 0.1636 & 0.1451 & 0.1317 \end{bmatrix}$

$B = \begin{bmatrix} 0.2794 & 0.0065 & 0.2271 & 0.1265 & 0.2773\\ 0.1676 & 0.2365 & 0.1430 & 0.1015 & 0.0632 \\ 0.0645 & 0.2274 & 0.1009 & 0.1806 & 0.0503\\ 0.2326 & 0.1261 & 0.2867 & 0.2846 & 0.1979 \end{bmatrix}$

Could anybody help me how to solve this problem? I need help with this.

Thanks for the help.

3

There are 3 best solutions below

2
On BEST ANSWER

Look at each column of $X$. If we denote it as $X_i$ and the columns of $B$ as $B_i$ then your problem reduces to 5 problems $$ A X_i = B_i $$ In each of the problems, you have more unknowns than equations, you know you will not have a unique solution.

If you use a calculator, the row-echelon form will give you a parametric solution. Alternatively, you can set one of the elements of $X_i$ to zero and reduce the number of unknowns and then parametrize by this variable. Let me show you how to do it for the first column and the rest are the same

$$ \begin{pmatrix}0.1375 & 0.0737 & 0.138 & 0.1169 & 0.1166\cr 0.0926 & 0.0707 & 0.0957 & 0.0873 & 0.0733\cr 0.0767 & 0.0642 & 0.081 & 0.0766 & 0.0599\cr 0.1593 & 0.102 & 0.1636 & 0.1451 & 0.1317\end{pmatrix} \begin{pmatrix} x_1 \\ x_2 \\ x_3 \\ x_4 \\ x_5 \end{pmatrix}= \begin{pmatrix}0.2794\cr 0.1676\cr 0.0645\cr 0.2326\end{pmatrix} $$ Move $x_5$ to the right and side to write $$ \begin{pmatrix}0.1375 & 0.0737 & 0.138 & 0.1169\cr 0.0926 & 0.0707 & 0.0957 & 0.0873\cr 0.0767 & 0.0642 & 0.081 & 0.0766\cr 0.1593 & 0.102 & 0.1636 & 0.1451\end{pmatrix} \begin{pmatrix} x_1 \\ x_2 \\ x_3 \\ x_4 \end{pmatrix}=\begin{pmatrix}-0.1166\cr -0.0733\cr -0.0599\cr -0.1317\end{pmatrix}x_5 + \begin{pmatrix}0.2794\cr 0.1676\cr 0.0645\cr 0.2326\end{pmatrix} $$

Solve this as you normally would. Here $x_5$ is a free variable.

note For this to work, you need to make sure that (a) rows are linearly independent. If not get rid of dependent rows; (b) Make sure that the columns you keep on the left are linearly independent. In this case I checked both to be true

1
On

Write $B=(b_1,\dots,b_n)$ and $X=(x_1,\dots,x_n)$ with $b_i$ and $x_i$ the columns of $B$ and $X$ respectively. I assume you are able to solve $Ax=b$. Now, solve the $n$ linear equations $Ax_1=b_1$ to $Ax_n=b_n$. You can now 'glue' the $x_i$ together to get the matrix $X$.

0
On

A little theory: It is concerned with the Kronecker product and the vectorization of matrices.
The Kronecker product, denoted by $\otimes$, is an operation on two matrices of arbitrary size resulting in a block matrix. For example, $A \in R^{m \times n}, B \in R^{p \times q}$, then the Kronecker product $A \otimes B$ is the $mp \times nq$ block matrix: $\begin{bmatrix} a_{11}B & \cdots & a_{1n}B \\ \cdots & \cdots & \cdots \\ a_{m1}B & \cdots & a_{mn}B \end{bmatrix}$.
The vectorization of a matrix $X$, denoted by $\operatorname{vec}(X)$, is formed by stacking the columns of $X$ into a single column vector. For example, if $A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix}$, then $\operatorname{vec}(A) = \begin{bmatrix} 1 \\ 4 \\ 2 \\ 5 \\ 3 \\ 6 \end{bmatrix}$.
The key point here is:

The Kronecker product, together with the vectorization, can be used to get a convenient representation for some matrix equations. For the matrix equation $AXB = C$, where $A, B$ and $C$ are given matrices and the matrix $X$ is the unknown. We can rewrite this equation as: $(B^\top \otimes A) \operatorname{vec}(X) = \operatorname{vec}(AXB) = \operatorname{vec}(C)$. Now, we get a linear system and you can solve it in standard ways.

For your problem: $AX = B \Rightarrow AXI = B \Rightarrow \operatorname{vec}(AXI) = \operatorname{vec}(B) \Rightarrow (I^{\top} \otimes A) \operatorname{vec}(X) = \operatorname{vec}(B)$ $\Rightarrow (I \otimes A) \operatorname{vec}(X) = \operatorname{vec}(B)$. It is a linear system now.

There are also some useful theorems on Kronecker product to help you to identify when your matrix equation has a unique solution.