**Linear Algebra**

# Guide on System of Linear Equations in Linear Algebra

*schedule*Jan 14, 2024

*toc*Table of Contents

*expand_more*

**mathematics behind data science**with 100+ top-tier guides

Start your free 7-days trial now!

# Linear equation

An equation is said to be a linear equation with $n$ variables $x_1$, $x_2$, $\cdots$, $x_n$ if and only if the equation has the following form:

Where:

$a_1$, $a_2$, $\cdots$, $a_n$ and $b$ are some constants.

at least one of $a_1$, $a_2$, $\cdots$, $a_n$ is non-zero.

The variables $x_1$, $x_2$, $\cdots$, $x_n$ are also known as unknowns, and $b$ is sometimes referred to as the constant term.

## Linear equations

The following is an example of a linear equation with two variables:

Note the following:

when working with two variables, we often denote the variables as $x$ and $y$.

when working with three variables, we often denote the variables as $x$, $y$ and $z$.

The following is an example of a linear equation with three variables:

## Non-linear equations

The following are some examples of non-linear equations:

These are non-linear because the variables $x_1$, $x_2$, $\cdots$, $x_n$ in a linear equation must be of the following form by definition:

# Graphical representation of a linear equation

Recall that an equation of a line in two-dimensional space is given by:

Where $a$, $b$ and $c$ are constants. This is a linear equation with two variables $x$ and $y$. Given the constant terms, we can visualize the linear equation. For instance, the $2x+3y=4$ can be visualized by the following plot:

Similarly, a linear equation with three variables $x$, $y$ and $z$ can also be graphed. For example, the graph of the linear equation $2x+3y+4z=5$ is:

As we can see, the linear equation with $3$ variables is a flat plane when visualized.

The graphs of the linear equations motivate why linear equations are described as "linear" - their graphs are straight and non-curvy. In contrast, a non-linear equation such as $2x^2+3y=4$ will take on a curvy shape:

# Homogeneous linear equation

A homogeneous linear equation with $n$ variables $x_1$, $x_2$, $\cdots$, $x_n$ has the following form:

A homogeneous linear system is a collection of homogeneous linear equations - for instance:

We will later cover some applications of homogenous linear equations.

# System of linear equations

A finite set of linear equations with $n$ variables is called a system of linear equations or simultaneous equations:

A solution of a system of linear equations is the values that the variables $x_1$, $x_2$, $\cdots$, $x_n$ take on to make all the above equalities hold.

## Computing a solution of a system of linear equations

Compute the solution of the following simultaneous equations:

Solution. Subtracting the bottom equation from the top equation yields:

Substituting $x=2$ into the bottom equation:

Therefore, the solution of the simultaneous equations is the pair $x=2$ and $y=-1$.

# Consistent and inconsistent system of linear equations

A consistent system of linear equations has either one solution or infinitely many solutions. An inconsistent system of linear equations has no solution.

## Inconsistent system with no solution

Consider the following system of linear equations:

Show that this system is inconsistent.

Solution. Subtracting the second equation from the first equation yields:

We get a contradiction here, which means that there exists no $(x,y)$ pair that satisfy both our linear equations. Because there exists no solution, our linear system of equations is inconsistent.

Let's graph the two equations:

As we can see, the lines are parallel to each other and thus never intersect.

## Consistent system with a single solution

Consider the following system of linear equations:

Show that this system is consistent.

Solution. Subtracting the second equation from the first equation:

Substituting the value of $x$ into the top equation:

Since a solution exists, this system of linear equations is consistent.

Let's graph the two equations:

We can see that the two lines intersect at a single point $(2,6)$, just as we calculated! We sometimes refer to the intersection point as a unique solution.

## Consistent system with infinitely many solutions

Consider the following system of linear equations:

Show that this system is consistent.

Solution. Multiplying the top equation by $2$ and then subtracting the bottom equation from the top equation:

This tells us that the top and bottom equations are equivalent! We have only $1$ equation with $2$ unknowns, which means setting any value for one variable will determine the value of the other variable:

Here, setting any value for $x$ will give us a new value for $y$. Because there are infinitely many intersection points between the two identical equations, there are infinitely many solutions. This means that the system is consistent.

Let's plot the two equations:

We only see one line here because the two equations overlap with one another. Every point on this line is a solution.

# Matrix form of system of linear equations

All systems of linear equations can be expressed in the following matrix form:

Where:

$\boldsymbol{A}\in\mathbb{R}^{m\times{n}}$ is the matrix holding the coefficients of the variables.

$\boldsymbol{x}\in\mathbb{R}^n$ is a vector holding the variables $x_1$, $x_2$, $\cdots$, $x_n$.

$\boldsymbol{b}\in\mathbb{R}^m$ is a vector holding the constant terms $b_1$, $b_2$, $\cdots$, $b_m$.

Expressing a system of linear equations in matrix form allows us to use a technique called Gaussian Elimination to find the solutions. This will be the topic of the next section.

Sketch proof. Consider the following system of linear equations:

This can be written in the following matrix form:

Performing the matrix-vector multiplication on the left:

Equating the components gives us the original system of linear equations.

Here's another example - consider the following simultaneous equation:

The corresponding matrix form is:

We often denote:

the matrix containing the coefficients as $\boldsymbol{A}$.

the vector containing the variables as $\boldsymbol{x}$.

the vector on the right as $\boldsymbol{b}$.

Therefore, the short-hand notation of the matrix form of a system of linear equations is:

This completes the sketch proof.

## Expressing a system of linear equations in matrix form

Express the following system of linear equations in matrix form:

Solution. The system of linear equation in matrix form is:

The following theorem is useful for future proofs - feel free to skip it for now and come back later when referenced.

# Expressing a system of vector equations as a matrix product

Consider the following vector equations:

Where:

$\boldsymbol{v}_1, \boldsymbol{v}_2,\cdots, \boldsymbol{v}_m\in\mathbb{R}^k$.

$\boldsymbol{a}_1,\boldsymbol{a}_2,\cdots,\boldsymbol{a}_n\in \mathbb{R}^k$.

$b_{ij}\in\mathbb{R}$ for $1\le{i}\le{m}$ and $1\le{j}\le{n}$.

The equations in \eqref{eq:buhgshTVAp7jnzGG7E2} hold if and only if the following holds:

Where $\boldsymbol{B}$ is an $m\times{n}$ matrix:

Proof. Suppose we have the following vector equations:

Define an $k\times{n}$ matrix $\boldsymbol{A}$ and an $m\times{n}$ matrix $\boldsymbol{B}$ like so:

The transpose $\boldsymbol{B}^T$ can be expressed as a collection of column vectors:

By theoremlink, we have that:

Here, the column vectors of $\boldsymbol{B}^T$ are:

By theoremlink, every column in \eqref{eq:AScL9hXe2XbDLR4P2GH} can be expressed as:

Comparing this with \eqref{eq:hHq8hy4pXBtw3QbSv62} gives:

Therefore, \eqref{eq:AScL9hXe2XbDLR4P2GH} can be written as:

This completes the proof.

# Practice problems

Consider the following equations:

Identify the linear equations.

All equations are linear.

None of the equations are linear.

Equation 1 is linear.

Equations 1 and 3 are linear.

Equation 2 is not linear because the variable $x_1$ is raised to the power of $2$.

Solve the following system of linear equations:

Separate your values for $x$ and $y$ using a comma (e.g. if your answer is $x=1$ and $y=2$, then $1,2$).

Multiply the bottom equation to get:

Subtracting the bottom equation from the top equation gives:

Substituting this value of $y$ into the second equation gives:

Consider the following system of linear equations:

Which of the following is true?

The system is consistent with an unique solution.

The system is consistent with infinitely many solutions.

The system is inconsistent with no solution.

The solution to this system of linear equations is $x=2$ and $y=2$. This means that the system is consistent with an unique solution.

Consider the following system of linear equations:

Which of the following is true?

The system is consistent with an unique solution.

The system is consistent with infinitely many solutions.

The system is inconsistent with no solution.

Multiplying the second equation by $2$ gives us the first equation. If we subtract them, then we end up with $0=0$. This means that there are infinitely many solutions - the two equations will be the same line if we plot them as a graph.

Consider the following system of linear equations:

Express this in matrix form.

The matrix form of the system of linear equations is:

Consider the following:

Express this as a system of linear equations in non-matrix form.

The system of linear equations in non-matrix form is: