# LaTeX & MathJax basic tutorial – System of equations

## System of equations

• Use \begin{array}…\end{array} and \left\{…\right.. For example, you get this:

$$\left\{ \begin{array}{c} a_1x+b_1y+c_1z=d_1 \\ a_2x+b_2y+c_2z=d_2 \\ a_3x+b_3y+c_3z=d_3 \end{array} \right.$$

by writing this:

• Alternatively we can use \begin{cases}…\end{cases}. The same system

$$\begin{cases} a_1x+b_1y+c_1z=d_1 \\ a_2x+b_2y+c_2z=d_2 \\ a_3x+b_3y+c_3z=d_3 \end{cases}$$

is produced by the following code

• To align the = signs use \begin{aligned}...\end{aligned} and \left\{…\right. (see asmeurer’s comment)
\left\{\begin{aligned} a_1x+b_1y+c_1z& =d_1+e_1 \\ a_2x+b_2y& =d_2 \\ a_3x+b_3y+c_3z& =d_3 \end{aligned} \right.

whose code is

• To align the = signs and the terms as in
$$\left\{\begin{array}{ll}a_1x+b_1y+c_1z & =d_1+e_1 \\ a_2x+b_2y & =d_2 \\ a_3x+b_3y+c_3z & =d_3 \end{array} \right.$$

use array with l (for “align left“; there are also c and r) parameters

• Vertical space between equations. As explained in Definition by cases to get a larger vertical space between equations we can use \\[2ex] instead of \\. The system

$$\begin{cases} a_1x+b_1y+c_1z=\frac{p_1}{q_1} \\[2ex] a_2x+b_2y+c_2z=\frac{p_2}{q_2} \\[2ex] a_3x+b_3y+c_3z=\frac{p_3}{q_3} \end{cases}$$

is generated by the following code

in comparison with

$$\begin{cases} a_1x+b_1y+c_1z=\frac{p_1}{q_1} \\ a_2x+b_2y+c_2z=\frac{p_2}{q_2} \\ a_3x+b_3y+c_3z=\frac{p_3}{q_3} \end{cases}$$

whose code is

• In response to elect’s comment. The following code

produces

$$\left\{ \begin{array}{l} 0 = c_x-a_{x0}-d_{x0}\dfrac{(c_x-a_{x0})\cdot d_{x0}}{\|d_{x0}\|^2} + c_x-a_{x1}-d_{x1}\dfrac{(c_x-a_{x1})\cdot d_{x1}}{\|d_{x1}\|^2} \\[2ex] 0 = c_y-a_{y0}-d_{y0}\dfrac{(c_y-a_{y0})\cdot d_{y0}}{\|d_{y0}\|^2} + c_y-a_{y1}-d_{y1}\dfrac{(c_y-a_{y1})\cdot d_{y1}}{\|d_{y1}\|^2} \end{array} \right.$$