# Solving linear equation

I have learned how to solve linear equation with Gauss-Jordan Elimination method, but I have came across a type of equation I don't know how to solve using that method. I tried other methods but didn't go far.

For example, this equation:

0.4p1 + 0.8p2 + 0.1p3 = p1
0.3p1 + 0.2p2 + 0.3p3 = p2
0.3p1 + 0.0p2 + 0.6p3 = p3


A hint is given that p1+p2+p3 = 1. But I don't understand how to solve this, because p1, p2 and p3 are unknown.

I can use any method for linear equations, doesn't have to be Gauss-Jordan method. Any help is appreciated.

• It's interesting to notice that every column sums up to exactly $1\cdot p_i$. Also, can't you just subtract $p_i$ in the $i$th equation? Meaning the first line says $-0.6p_1 + 0.8p_2 + 0.1p_3 = 0$, do this for every line, and you get a linear system of equations of the form $A\vec{x} = \vec{0}$? Commented May 21, 2016 at 20:20

The problem is that you don't have all the unknown variables $p_i$ on the same side of the equation, as you should for the normal $Ax=b$ equation. But you can just subtract them off to move them. When you do, you get

$$-0.6p_1+0.8p_2+0.1p_3=0 \\ 0.3p_1-0.8p_2+0.3p_3=0 \\ 0.3p_1+0p_2-0.4p_3=0.$$

You can solve this system with Gaussian elimination now.

• In that case, I get p3=0, p2=(7/8)p3 and p1=(4/3)p3 unless I did something wrong. And the answers in my book are p1 = 0.416, p2=0.273, p3=0.311. Commented May 21, 2016 at 20:46
• In this case, $Ax = b$ is $$\begin{pmatrix} -0.6 & 0.8 & 0.1\\ 0.3 &- 0.8 & 0.3 \\ 0.3& 0 & -0.4 \end{pmatrix}\cdot \begin{pmatrix} p_1\\ p_2\\p_3 \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix}$$
– JnxF
Commented May 21, 2016 at 20:56
• Thanks a lot for your help, appreciate it very much. Commented May 21, 2016 at 20:57
• @user339531 It looks like you made a mistake, you should find that the last equation is $0=0$ after you row reduce, so $p_3$ should be free and the others should be determined in terms of $p_3$. You can then find $p_3$ using the normalization condition $p_1+p_2+p_3=1$.
– Ian
Commented May 21, 2016 at 21:19
• @Ian I tried and didn't get the answers. I got p3 to be free and p2=0.875p3 and p1=1.3p3. Commented May 22, 2016 at 9:04

Your equation can be written as $$A p = p = I p \iff \\ A p - I p = (A-I) p = 0$$ where $I$ is the identity matrix (upper left to lower right diagonal entries $1$, otherwise $0$).

In this case it turns out that the matrix $A-I$ is of rank $2$ only, this means the solution space is one-dimensional. One needs an extra equation, here $(1,1,1) p = 1$, to single out a unique solution.

You can first reduce to two rows and then add the extra equation, or add the extra equation for a $4 \times 3$ matrix and then go into row-echelon form, see below:

Example Calculation:

This is the matrix $A - I$ extended by the extra row $(1,1,1)$ for the additional equation:

B =

-0.60000   0.80000   0.10000
0.30000  -0.80000   0.30000
0.30000   0.00000  -0.40000
1.00000   1.00000   1.00000


With the following solution vector $b$ the resulting equation $B p = b$ will represent the equation $(A - I) p = 0$ in the first three rows and $(1,1,1) p = 1$ in the last row.

>> b
b =

0
0
0
1


We group $B$ and $b$ into one augmented matrix $[B\vert b]$.

>> M = [B,b]
M =

-0.60000   0.80000   0.10000   0.00000
0.30000  -0.80000   0.30000   0.00000
0.30000   0.00000  -0.40000   0.00000
1.00000   1.00000   1.00000   1.00000


On this we perform Gauss-Jordan elimination, to get the row-echelon form:

>> L = rref(M)
L =

1.00000   0.00000   0.00000   0.41558
0.00000   1.00000   0.00000   0.27273
0.00000   0.00000   1.00000   0.31169
0.00000   0.00000   0.00000   0.00000

• I'm sorry, but I don't really understand your equation. Could you explain it, preferably with an example? Commented May 21, 2016 at 20:27
• Based on your calculation, you get different answers than the one in my book. The answers here are: p1 = 0.416, p2=0.273, p3=0.311 Commented May 21, 2016 at 20:34
• I have a question. I understand pretty much everything except the very last part. What is rref(M)? What do I have to do if I were to solve it manually? Commented May 21, 2016 at 20:48
• That is Gauss-Jordan on the augmented matrix $M = [B,b]$, bringing it into row echelon form.
– mvw
Commented May 21, 2016 at 20:51
• Thanks a lot for your help, appreciate it very much. Commented May 21, 2016 at 20:57