skip to content
OscarGiCast

pythonic_human 🐍

Linear systems in Latex

/ 1 min read

Define a single equation

To represent and inline equation like this: a+b+c=10a + b + c = 10, use the following syntax:

$$a + b + c = 10$$

But if we want to define an equation in a linear system like this:

a+b+c=10\begin{equation} a + b + c = 10 \end{equation}
\begin{equation}
a + b + c = 10
\end{equation}

More than one equation

In separate systems:

a+b=10a+2b=12\begin{align} a + b &= 10 \\ a + 2b &= 12 \end{align}
\begin{align}
a + b &= 10 \\
a + 2b &= 12
\end{align}

In the same system:

$$ \begin{equation} \left\{ \begin{array}{rcl} a + b & = & 10 \\ a + 2b & = & 12 \end{array} \right. \end{equation} $$
system.tex
\begin{equation}
\left{
\begin{array}{rcl}
a + b & = & 10 \\
a + 2b & = & 12
\end{array}
\right
\label{eq:system}
\end{equation}

The & is used for alignment.

In matrix form

This system of equations can be expressed in matrix form as follows:

[1112][ab]=[1012]\begin{bmatrix} 1 & 1 \\ 1 & 2 \end{bmatrix} \begin{bmatrix} a \\ b \end{bmatrix} = \begin{bmatrix} 10 \\ 12 \end{bmatrix}
matrix.tex
\begin{bmatrix}
1 & 1 \\
1 & 2
\end{bmatrix}
\begin{bmatrix}
a \\
b
\end{bmatrix}
=
\begin{bmatrix}
10 \\
12
\end{bmatrix}