Linear Equations
A linear equation is an algebraic equation that can be plotted on a graph as a straight line. Linear equations are very common in algebra, so it is important to know how to render one in LaTeX if you are creating something like a math textbook.
Example 5.1 Linear Equation differentiate letters from variables
Use the example y = 2x + 5
If you wrap it in [latex][/latex], it would look like:
[latex]y=2x+5[/latex]
The first equation is written in regular text, the second in LaTeX. Linear equations using LaTeX are clearer as they emphasize that regular letters represent variables.
Example 5.2: Fractions are Distinct
Fractions can look more distinct from the text:
By using only Pressbooks characters: y=1/2x+3
By using LaTeX: [latex]y=\dfrac{1}{2}x+3[/latex]
The LaTeX code for above is y=\dfrac{1}{2}x+3 with the addition of the LaTeX wrappers.
5.3 Steps in a Linear Equation: Using Arrays
Demonstrating how to solve a linear equation is much easier to display in LaTeX. more than one step of the solution and to display it in a way that the reader can easily follow what is happening. An excellent way to achieve this is through an array. Refer to Aligning Elements for more information about the specifics of arrays.
The example below shows the step by step solution to 3x + 7 = 19:
[latex]\begin{array}{rrrrr} 3x&+&7&=&19 \\ &-&7&&-7 \\ \hline &&\dfrac{3x}{3}&=&\dfrac{12}{3} \\ \\ &&x&=&4 \end{array}[/latex]
In this version, you can see that 7 is subtracted from both sides of the equation to gather the constants and the variables on opposite sides; each side is divided by 3, and the solution is that x equals 4. This is a clear, comprehensive way to display an equation.
5.4 Using Arrays
You may also add and remove steps as you wish. For example, you can separate out the subtraction and the division steps:
[latex]\begin{array}{rrrrr} 3x&+&7&=&19 \\ &-&7&&-7 \\ \hline &&3x&=&12 \\ \\ &&\dfrac{3x}{3}&=&\dfrac{12}{3} \\ \\ &&x&=&4 \end{array}[/latex]