Pulsars
0 %
Log inSign up

Solving AX = B

Writing a system as AX = B

Every linear system can be written on a single line using matrices. This is not merely shorthand: it changes the way the problem is thought about.

From system to matrix equation

Take a system of two equations:

{ 3x +  y =  9
{ 5x + 2y = 16

Separate the coefficients, the unknowns and the right-hand side:

   A          X       B
[ 3  1 ]   [ x ]   [  9 ]
[ 5  2 ] × [ y ] = [ 16 ]

The whole system becomes A X = B. The matrix A is called the coefficient matrix, X the vector of unknowns, B the right-hand side. This form works at any size: a thousand equations in a thousand unknowns are still written A X = B.

Checking that the product does give back the system

This is not an arbitrary convention: the definition of the matrix product reconstructs the equations exactly.

[ 3  1 ]   [ x ]   [ 3x + 1y ]   [  9 ]
[ 5  2 ] × [ y ] = [ 5x + 2y ] = [ 16 ]

Row by row we recover 3x + y = 9 and 5x + 2y = 16.

The column reading

There is a second, richer reading. Expand the product differently:

[ 3  1 ]   [ x ]        [ 3 ]       [ 1 ]
[ 5  2 ] × [ y ]  =  x  [ 5 ]  +  y [ 2 ]

The product A X is a combination of the columns of A, with the unknowns as coefficients. Solving A X = B therefore amounts to asking:

Can the vector B be built by combining the columns of A?

        column 1     column 2          B
           [3]          [1]           [ 9]
        x  [5]   +   y  [2]     =     [16]

    x = 2, y = 3  ->  2(3;5) + 3(1;2) = (6+3 ; 10+6) = (9 ; 16)   ✔

This reading explains all three possible cases at once:

  • if B is reachable in exactly one way → unique solution;
  • if B is not reachable → no solution;
  • if B is reachable in several ways (redundant columns) → infinitely many.

The benefits of matrix notation

System written out in full           Matrix notation
--------------------------           ---------------
{ 3x + y = 9                          A X = B
{ 5x + 2y = 16
                                     -> we reason about A,
unwieldy beyond 4 unknowns              not about letters

It lets us talk about the system without the unknowns: its properties (number of solutions, numerical stability, invertibility) depend only on A and B. It is also the form every computing library consumes: in Python, numpy.linalg.solve(A, B) expects exactly these two objects.

Summary

  • Every linear system is written A X = B: coefficient matrix, unknown vector, right-hand side.
  • The product A X reconstructs the equations row by row.
  • Another reading: A X is a combination of the columns of A.
  • Solving means asking whether B can be written as a combination of the columns of A.
  • This notation is size-independent and serves as the interface to computing tools.