Skip to main content

Solving Ax=bA\vec{x}=\vec{b}

Say we have a matrix AA we need to find solution space for Ax=bA\vec{x}=\vec{b} for any given b\vec{b}.
Let's consider same example we took in Null space discussion.

A=[1222246836810]A=\begin{bmatrix} 1 & 2 & 2 & 2\\ 2 & 4 & 6 & 8\\ 3 & 6 & 8 & 10\\ \end{bmatrix}

So

Ax=[1222246836810][x1x2x3x4]=[b1b2b3]A\vec{x} = \begin{bmatrix} 1 & 2 & 2 & 2\\ 2 & 4 & 6 & 8\\ 3 & 6 & 8 & 10\\ \end{bmatrix} \begin{bmatrix} x_1\\x_2\\x_3\\x_4\\ \end{bmatrix} = \begin{bmatrix} b_1\\b_2\\b_3\\ \end{bmatrix}

It give us a set of equations:

x1+2x2+2x3+2x4=b12x1+4x2+6x3+8x4=b23x1+6x2+8x3+10x4=b3\begin{matrix} x_1 & + & 2x_2 & + & 2x_3 & + & 2x_4 & = & b_1 \\ 2x_1 & + & 4x_2 & + & 6x_3 & + & 8x_4 & = & b_2 \\ 3x_1 & + & 6x_2 & + & 8x_3 & + & 10x_4 & = & b_3 \\ \end{matrix}

AxA\vec{x} is just a linear combinations of column vector of matrix AA, so the resultant of this linear combination must lie in the column space of AA. So

info

Ax=bA\vec{x}=\vec{b} is solvable if b\vec{b} lies in the column space of AA

How can we find all the x\vec{x} that solves Ax=bA\vec{x}=\vec{b}?

Let's find a solution for Ax=bA\vec{x}=\vec{b}
Now we have to find a particular x\vec{x} that solves Ax=bA\vec{x}=\vec{b}, say this particular solution be xp\vec{x}_p

Our matrix is A=[1222246836810]A=\begin{bmatrix} 1 & 2 & 2 & 2\\ 2 & 4 & 6 & 8\\ 3 & 6 & 8 & 10\\ \end{bmatrix}

First we convert our matrix in echelon form using Elimination technique, and unlike in null space here we also have bib_i's so we use Augmented matrix.
So our Augmented matrix is:

[1222b12468b236810b3]\left[ \begin{array}{cccc|c} 1 & 2 & 2 & 2 & b_1\\ 2 & 4 & 6 & 8 & b_2\\ 3 & 6 & 8 & 10 & b_3\\ \end{array} \right]

Now let's do elimination.

Step 1: of elimination method, here we make all element 00 in c1c_1 below the 1st1^{st} element.
r2r22r1r_2\leftarrow r_2 - 2r_1

[1222b10024b22b136810b3]\left[ \begin{array}{cccc|c} 1 & 2 & 2 & 2 & b_1\\ 0 & 0 & 2 & 4 & b_2-2b_1\\ 3 & 6 & 8 & 10 & b_3\\ \end{array} \right]

r3r33r1r_3\leftarrow r_3 - 3r_1

[1222b10024b22b10024b33b1]\left[ \begin{array}{cccc|c} \fbox{1} & 2 & 2 & 2 & b_1\\ 0 & 0 & 2 & 4 & b_2-2b_1\\ 0 & 0 & 2 & 4 & b_3-3b_1\\ \end{array} \right]

Step 2: of elimination method, here we make all element 00 in c2c_2 below the 2nd2^{nd} element.
But 2nd2^{nd} element itself is 00, and all element below it also 00, so we move forward.

Step 3: of elimination method, here we make all element 00 in c3c_3 below the 2nd2^{nd} element.

[1222b10024b22b10024b33b1]\left[ \begin{array}{cccc|c} \fbox{1} & 2 & 2 & 2 & b_1\\ 0 & 0 & 2 & 4 & b_2-2b_1\\ 0 & 0 & 2 & 4 & b_3-3b_1\\ \end{array} \right]

r3r3r2r_3\leftarrow r_3-r_2

[1222b10024b22b10000b3b2b1]\left[ \begin{array}{cccc|c} \fbox{1} & 2 & 2 & 2 & b_1 \\ 0 & 0 & \fbox{2} & 4 & b_2 -2b_1 \\ 0 & 0 & 0 & 0 & b_3 -b_2 - b_1\\ \end{array} \right]

(Notice the last row it indicates that b3b2b1=0b_3 -b_2 - b_1=0.)
Here c2,c4c_2,c_4 are free columns, and c1,c3c_1,c_3 are pivot columns, we discussed about them in Null space section.
So x2,x4x_2,x_4 are free variable we are free to assign any value to them. So say x2=x4=0x_2=x_4=0
Now say we want to find solution space for Axp=[156]A\vec{x}_p= \begin{bmatrix} 1\\5\\6\\ \end{bmatrix}
( b3b2b1=651=0b_3 -b_2 - b_1=6-5-1=0 so it's a valid question to ask )
So our system of equation becomes:

x1+0+2x3+0=10+0+2x3+0=5210+0+0+0=651\begin{matrix} x_1 & + & 0 & + & 2x_3 & + & 0 & = & 1 \\ 0 & + & 0 & + & 2x_3 & + & 0 & = & 5-2*1 \\ 0 & + & 0 & + & 0 & + & 0 & = & 6-5-1 \\ \end{matrix}

by solving them: x3=3/2,x1=2x_3=3/2, x_1=-2
So xp=[203/20]\vec{x}_p=\begin{bmatrix} -2\\0\\3/2\\0\\ \end{bmatrix}

note

Remember our approach when we are finding Null Space:
We were finding solution for Ax=0A\vec{x}=0 and what we did is, we took our free variables, and iteratively we set one free variable to 11 and all other free variables to 00.
By this we create multiple special solutions and each special solution consider a particular free column vector.
Then we took linear combination of all of those special solutions.

Now here what we are doing is, we aren't considering any of the free column vector, because our Null space had already considered them for us.
Now say xn\vec{x}_n represent the Null Space of matrix AA, so Ax=0;xxnA\vec{x}=0;\quad x\in x_n
xn\vec{x}_n represents a vector space(it's not a single vector), it's a linear combination of bunch of vectors.
So complete solution for Ax=bA\vec{x}=\vec{b} is:

info

x=xp+xn\vec{x} = \vec{x}_p+\vec{x}_n

So any xxp+xn\vec{x}\in\vec{x}_p+\vec{x}_n solves Ax=bA\vec{x}=\vec{b}

note

But remember that xp\vec{x}_p is a vector, and xn\vec{x}_n is a vector space it's some dd-dimensional subspace.
How can we add a vector xp\vec{x}_p and a subspace xn\vec{x}_n? Think about a surface in 33-dimensions, let's say that surface is a plane then when we add a vector to a plane, we are just shifting that plane in the direction of vector.
So xp\vec{x}_p is just shifting the Null Space in it's direction.
And when xp\vec{x}_p shifts the Null space then the shifted space is no longer in contact with origin, so the resultant space xp+xn\vec{x}_p+\vec{x}_n is not a subspace.

As we derived Null space of AA in Null space section.

xn=α[2100]+β[2021];α,βR\vec{x}_n=\alpha \begin{bmatrix} -2\\1\\0\\0\\ \end{bmatrix} + \beta \begin{bmatrix} 2\\0\\-2\\1\\ \end{bmatrix};\quad \alpha,\beta\in\mathbb{R}

So complete solution for our example is:

x=[203/20]+α[2100]+β[2021];α,βR\vec{x} = \begin{bmatrix} -2\\0\\3/2\\0\\ \end{bmatrix} + \alpha \begin{bmatrix} -2\\1\\0\\0\\ \end{bmatrix} + \beta \begin{bmatrix} 2\\0\\-2\\1\\ \end{bmatrix} ;\quad \alpha,\beta\in\mathbb{R}
info

So the solution space of Axp=[156]A\vec{x}_p= \begin{bmatrix} 1\\5\\6\\ \end{bmatrix} is a plane in R4\mathbb{R}^4.