# Matrix solution of a system of linear equations for an arbitrarily chosen set of variables

When expressing a set of variables $$\{y_i \}$$ as a linear combination of another set of variables $$\{x_i\}$$, the matrix expression for the case $$2\times2$$ is

$$\left[\begin{array}{c} y_{1} \\ y_{2} \\ \end{array}\right]= \left[\begin{array}{cccc} a_{11} & a_{12} \\ a_{21} & a_{22} \\ \end{array}\right] \left[\begin{array}{c} x_{1} \\ x_{2} \\ \end{array}\right] \tag{1}$$

so it is quite straightforward to express the $$\{x_i\}$$ variables in terms of the $$\{y_i\}$$ variables by by simply making use of the inverse matrix:

$$\left[\begin{array}{c} x_{1} \\ x_{2} \\ \end{array}\right]= \left[\begin{array}{cccc} a_{11} & a_{12} \\ a_{21} & a_{22} \\ \end{array}\right]^{-1} \left[\begin{array}{c} y_{1} \\ y_{2} \\ \end{array}\right] \\ =\frac{1}{a_{11}a_{22}-a_{12}a_{21}} \left[\begin{array}{cccc} a_{22} & -a_{12} \\ -a_{21} & a_{11} \\ \end{array}\right] \left[\begin{array}{c} y_{1} \\ y_{2} \\ \end{array}\right] \tag{2}$$

However, if we choose an arbitrary set of variables, say $$\{x_1,y_2\}$$, to be expressed in terms of the remaining variables $$\{x_2,y_1\}$$, would there be a matrix method to find from $$(1)$$ the corresponding matrix expression of $$(3)$$?

$${x_1}=\frac{{y_1}-{a_{12}} {x_2}}{{a_{11}}}, \quad {y_2}=\frac{{a_{21}} {y_1}+\left( {a_{11}} {a_{22}}-{a_{12}} {a_{21}}\right) {x_2}}{{a_{11}}} \tag{3}$$

Could that method be scaled for an arbitrary number $$n$$ of variables $$\{y_i\}$$ and $$\{x_i\}$$?

• Have a look at Schur complement. Jul 31, 2021 at 11:57

$$\begin{bmatrix}Y_1\\Y_2\end{bmatrix}=\begin{bmatrix}A&B\\C&D\end{bmatrix}\begin{bmatrix}X_1\\X_2\end{bmatrix}$$
Where $$X_1,X_2$$ and $$Y_1,Y_2$$ are $$p\times1,q\times1$$ matrices respectively (holding your desired parameters $$x_0,x_1,\cdots$$), and $$A$$ is a $$p\times p$$ matrix, $$B$$ is a $$p\times q$$ matrix, $$C$$ is a $$q\times p$$ matrix, and $$D$$ is a $$q\times q$$ matrix, collectively known as a block matrix. We get as a result: $$Y_1=AX_1+BX_2$$, $$Y_2=CX_1+DX_2$$. Suppose your desired parameter $$x_i$$ was in $$X_1$$, by way of example (the same process is applied if it were in $$X_2$$). Then you know that $$AX_1=Y_1-BX_2\implies X_1=A^{-1}(Y_1-BX_2)$$ and the $$i$$th element of $$X_1$$ will hold your parameter, $$x_i$$. If $$A$$ is not invertible, you should still be able to solve for the span of possible values of $$X_1$$ and thus the range of possibilities for $$x_i$$.