01 Elimination changes equations without losing solutions
Each row operation can be undone, so their product E is invertible. Multiplying both sides of Ax=b by E gives Ux=c; multiplying by E−1 recovers the original system. Here no row exchanges are needed, so E=L−1 and A=LU. If rows are exchanged in another problem, their permutation must act on b too.
Further invertible row operations take U to R. Thus Ax=0,Ux=0, and Rx=0 have the same solutions. For a nonzero right-hand side, reducing U further also requires reducing c;Rx=c would generally be a different system. Row operations preserve null space and rank but generally change column space: Col(EA)=ECol(A).
Ax=b⟺EAx=Eb⟺Ux=c
02 Existence is a condition on the target b
The last row of U is zero, so the transformed system requires c3=5b1−2b2+b3=0. This condition is also sufficient: when it holds, choose v and y freely, then use the two nonzero pivots to solve for w and u. For b_good=(1,5,5)T it holds; for b_bad=(1,5,6)T the last equation is 0=1.
This condition describes a plane through the origin in R3:Col(A). Pivot columns 1 and 3 of the original A give a basis a1=(1,2,−1)T,a3=(3,9,3)T. Column 2 equals 3a1; column 4 equals a3−a1. The vector ℓ=(5,−2,1)T satisfies ATℓ=0, so the consistency condition is also ℓTb=0.
Ax=b is consistent ⟺b∈Col(A)⟺rank([A∣b])=rank(A)
03 Free variables produce a basis, not just sample solutions
For Rx=0, the pivot equations give u=−3v+y and w=−y. Substitute v=α and y=β:x=α(−3,1,0,0)T+β(1,0,−1,1)T. Every homogeneous solution is in this span because the formula comes from all its equations.
The two vectors are independent: if αn1+βn2=0, the second coordinate forces α=0 and the fourth forces β=0. They form a basis of Null(A). Rank–nullity gives 2+2=4, the number of input coordinates, not 3, the number of equations.
Null(A)={αn1+βn2:α,β∈R}; rank(A)+dimNull(A)=n
04 Prove the complete solution formula in both directions
Assume consistency and choose xp with Axp=b. For any z in Null(A),A(xp+z)=Axp+Az=b+0=b. Every vector in the proposed family is therefore a solution.
Conversely, take any solution x. Then A(x−xp)=b−b=0, so x−xp belongs to Null(A) and equals αn1+βn2. The family therefore misses no solutions. A different particular solution changes the starting point, but not the set.
{x:Ax=b}=xp+Null(A)={xp+αn1+βn2:α,β∈R}
05 Separate existence, uniqueness, and geometry
For a consistent system, the solution is unique exactly when Null(A)={0}, equivalently r=n. If r < n, a nonzero null-space direction produces infinitely many solutions over R. Without consistency there is no solution: Null(A)={0} alone does not guarantee existence for an arbitrary b.
Here r=2<4, so every reachable b has infinitely many solutions forming an affine plane in R4. For b=0 it misses the origin and is not a vector subspace. For b=0 it is Null(A). Separately, the reachable targets form a plane in R3. These planes live in different spaces.
inconsistent: none; consistent and r=n: one; consistent and r < n: infinitely many
06 Apply the method to another m × n system
1. Row-reduce [A | b], keeping the variable order fixed and applying every operation to the whole augmented row. Identify the r coefficient pivots. 2. Check every all-zero coefficient row: a nonzero right-hand side proves inconsistency, so stop. Otherwise the system is consistent.
3. Set the n−r free variables to zero and solve the pivot equations for xp. 4. Return to Ax=0; set one free variable to 1 and all other free variables to 0 in turn, solving for the pivot variables each time. This gives a basis n1,…,nn−r. 5. Write x=xp+t1n1+⋯+tn−rnn−r with arbitrary real parameters, and check using the original A and b.
The walkthrough follows a known pivot sequence for this matrix, not a general elimination routine. With floating-point or noisy data, choose scale-appropriate tolerances. np.linalg.matrix_rank estimates rank numerically; np.allclose checks approximate equality. Neither replaces the exact proof of the full solution set.
Does a zero row of U automatically mean no solution?
No. Check the matching entry of c=Eb. Zero gives the redundant equation 0=0; a nonzero entry gives a contradiction. Here check 5b1−2b2+b3.
Can R’s pivot columns be used as a basis of Col(A)?
Use their column indices, then take those columns of the original A. R’s pivot columns span the plane whose third coordinate is zero; Col(A) is the different plane 5b1−2b2+b3=0.
For b=(1,5,5)T, what happens at α=0 and β=1?
x=xp+n2=(−1,0,0,1)T. Its image is −a1+a4=(1,5,5)T. The input changes, but b does not.
Why do we need two free parameters?
Four unknowns minus two pivots leaves n−r=2 free variables. Both independent null-space directions are needed: xp+n2 cannot be obtained from xp+αn1 alone.
Could a rectangular matrix have a unique solution?
Yes, for a consistent target if it has full column rank(r=n), requiring m≥n. This particular 3 × 4 matrix has r=2, so every consistent target has infinitely many solutions.