Skip to content
Tutorials Center
My learning

Topics

Lesson 13 of 62 ยท Linear Systems

Systems of Linear Equations

Understand systems of linear equations as lines meeting and as column combinations, write them as Ax = b, and learn when there are one, no or infinitely many solutions.

Linear algebra grew out of a very practical problem: finding numbers that satisfy several linear equations at once. A shop sells two products and you know total sales on two days. A circuit has unknown currents that must satisfy Kirchhoff's laws. A model has weights that must reproduce observed data. Each of these is a system of linear equations.

In this lesson you will see a system from two angles (the row picture and the column picture), write it in the compact form Ax = b, and learn the three possible outcomes: exactly one solution, none, or infinitely many. The next lessons show how to find the solutions.

What a linear system looks like

An equation is linear when each unknown appears only to the first power, multiplied by a number, and the terms are added. 2x + 3y = 12 is linear. xy = 4 and x^2 + y = 1 are not.

A system is a set of such equations sharing the same unknowns:

TEXT
 x + 2y = 5
3x -  y = 1

A solution is a choice of values that satisfies every equation at the same time. Here x = 1, y = 2 works: 1 + 4 = 5 and 3 - 2 = 1.

The row picture

Take one equation at a time. In two unknowns each equation describes a line. A solution has to lie on all the lines, so it is where they cross. With three unknowns each equation is a plane, and solutions sit where the planes meet.

Row picture

One equation A line in 2D, a plane in 3D.
Many equations Look for the point on all of them.

Solving means finding where the shapes intersect.

1 / 2
Python Where two lines cross

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The column picture

Look at the same system as a statement about vectors:

TEXT
x * [1]  +  y * [ 2]  =  [5]
    [3]         [-1]     [1]

Now the question is: how much of the first column and how much of the second must you add to build the target vector (5, 1)? This is exactly the column view of a matrix-vector product. The unknowns are the weights, and a solution exists only if the target lies in the span of the columns.

Python The same answer from the columns

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Matrix form: Ax = b

All the coefficients go into a matrix A, the unknowns into a vector x, and the right-hand sides into a vector b:

TEXT
[1  2] [x]   [5]
[3 -1] [y] = [1]

Multiplying out the left side gives back the two equations, so a system of m equations in n unknowns becomes Ax = b with A an m by n matrix. Before solving, it often helps to glue b onto A as an extra column, forming the augmented matrix [A | b]. That is what you will do in Gaussian elimination.

Python Building A, x and b

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

One, none or infinitely many

Linear systems have only three possible outcomes. There is never exactly two solutions or five.

Exactly one solution. The lines cross at a single point. The columns of A point in different directions and can reach any target in the plane.

No solution. The lines are parallel and never meet, as in x + y = 1 together with x + y = 3. In the column picture the target is not reachable: both columns point along one line, and the target is off it. The system is called inconsistent.

Infinitely many solutions. The equations describe the same line, as in x + y = 2 together with 2x + 2y = 4. Every point on the line is a solution, and in general the solution set is a whole line, plane or higher-dimensional flat space.

flowchart TB
    S["System Ax = b"] --> Q{"Is b in the span<br/>of the columns?"}
    Q -- "No" --> N["No solution"]
    Q -- "Yes" --> F{"Are there free<br/>unknowns?"}
    F -- "No" --> O["Exactly one solution"]
    F -- "Yes" --> I["Infinitely many solutions"]

Consistent systems have either one solution or infinitely many; inconsistent ones have none.

A shortcut for square systems: a unique solution exists exactly when the determinant is non-zero, which you will study in Determinants. NumPy raises LinAlgError for a singular matrix.

Python The three outcomes

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The test used here compares the rank of A with the rank of the augmented matrix. If adding b raises the rank, b is outside the column space and there is no solution.

Shapes: tall, wide and square

The number of equations versus unknowns hints at what to expect.

  • Square (m = n): usually one solution, unless A is singular.
  • Tall (m > n, more equations than unknowns): usually no exact solution; you then look for the best fit with least squares.
  • Wide (m < n, fewer equations): usually infinitely many solutions.

These are tendencies, not guarantees: redundant or contradictory equations change the outcome.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which of these equations is NOT linear in x and y?

    The term x*y multiplies the unknowns together, which is not allowed in a linear equation.
  2. 2. In the column picture of Ax = b, what do the unknowns represent?

    Ax is a weighted sum of the columns of A, with the entries of x as weights.
  3. 3. A linear system can NOT have exactly...

    If two solutions exist, every point on the line through them is also a solution, so there are infinitely many.
  4. 4. Two lines in a plane that are parallel but different give a system with...

    Parallel distinct lines never meet, so no point satisfies both equations.

Summary

  • A linear system asks for values that satisfy several linear equations at once.
  • Row picture: each equation is a line or plane, and solutions are intersections.
  • Column picture: the unknowns are weights that combine the columns of A into b.
  • The matrix form is Ax = b; gluing b onto A gives the augmented matrix [A | b].
  • There are exactly three outcomes: one solution, none, or infinitely many.
  • Compare rank(A) with rank([A | b]) to detect an inconsistent system.

Next: solve systems by hand in Gaussian Elimination.