Writing mathematical equations in LaTeX can seem intimidating at first—backslashes everywhere, cryptic commands, mysterious curly braces. But here’s what nobody tells you: once you understand the basics, LaTeX becomes incredibly powerful for writing professional math equations.
This guide will show you how to write LaTeX equations step-by-step, from simple formulas to complex mathematical expressions. Whether you’re a student, researcher, or just curious about LaTeX, you’ll learn the essential commands and best practices for mathematical typesetting.
Look, I won’t sugarcoat my first experience. I stared at a LaTeX document for five minutes wondering what alien language I’d encountered. But after that initial learning curve, I never wanted to use Word’s equation editor again.
What Is LaTeX and Why Use It for Math Equations?
LaTeX is a document preparation system used extensively in mathematics, physics, computer science, and academic writing. Unlike word processors, LaTeX gives you precise control over mathematical notation and formatting.
Fair question. Why not just use the equation editor in Word or Google Docs?
Because LaTeX equations look professional. They’re crisp, perfectly formatted, and consistent. When you’re writing a thesis, research paper, or anything with serious math, LaTeX is the standard. Plus, once you learn it, you can write complex equations faster than clicking through menus.
That said, there’s definitely a learning curve. Let me help you skip some of the painful parts.
If you’re completely new to LaTeX, I recommend starting with our beginner’s syntax guide to understand the fundamental structure before diving into math equations.
The Two Types of Math Mode (And Why It Matters)
In LaTeX, you can’t just type math anywhere. You need to tell LaTeX “hey, I’m about to write some math now.”
Inline math – for equations inside sentences:
The formula $E = mc^2$ revolutionized physics.
Display math – for centered, standalone equations:
\[ E = mc^2 \]
You can also use $$...$$ for display math, but honestly? Everyone will tell you not to. Use \[...\] instead. It plays nicer with spacing and modern LaTeX packages.
The Basic Commands You Actually Need
Forget memorizing 500 commands. Here are the ones you’ll use 80% of the time:
Superscripts and subscripts:
x^2 % x squared
x^{10} % x to the 10th
a_i % a subscript i
x_{max} % x subscript max (braces needed for multiple chars)
Fractions:
\frac{a}{b} % Creates a fraction
\frac{1}{2} % One half
Pro tip: In inline math, fractions look tiny. If that bugs you, use \dfrac{a}{b} instead for “display style” fractions.
Square roots:
\sqrt{x} % Square root of x
\sqrt[3]{8} % Cube root of 8
Greek letters (because math loves these):
\alpha, \beta, \gamma, \theta, \lambda, \pi, \sigma, \Omega
Capital versions? Just capitalize the first letter: \Gamma, \Delta, \Sigma
For a complete reference of all LaTeX math symbols and commands, check out our comprehensive LaTeX math commands guide.
The Stuff That Looks Scary But Isn’t
Integrals:
\int_0^\infty e^{-x} \, dx
The \, adds a tiny space before dx. Makes it look cleaner.
Summations:
\sum_{i=1}^{n} i^2
Limits:
\lim_{x \to 0} \frac{\sin x}{x} = 1
Notice the pattern? It’s always \command_{lower}^{upper}. Once you see that, it clicks.
Multi-Line Equations (The Right Way)
You’ll need the amsmath package for this. Add \usepackage{amsmath} to your document preamble.
\begin{align}
a + b &= c \\
x^2 + y^2 &= z^2
\end{align}
That & symbol? It’s the alignment point. Everything lines up there. The \\ means “new line.”
Matrices Without the Headache
\begin{bmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{bmatrix}
Want parentheses instead of brackets? Use pmatrix. Vertical bars? vmatrix. LaTeX has you covered.
For more advanced matrix operations and formatting options, see our detailed guide on mastering matrices in LaTeX.
Piecewise Functions
f(x) = \begin{cases}
x^2 & \text{if } x \geq 0 \\
-x & \text{if } x < 0
\end{cases}
The \text{} command is clutch here. It lets you write normal text inside math mode.
Three Mistakes I Made (So You Don’t Have To)
1. Forgetting to close environments
You write \begin{align} but forget \end{align}. LaTeX throws 47 error messages. Always close your environments.
If you’re running into compilation issues, our common LaTeX errors guide covers the most frequent problems and how to fix them fast.
2. Using * for multiplication
Use \cdot or \times instead. This is math typesetting, not programming.
3. Not using \left( \right) for parentheses
Regular parentheses don’t resize. Compare:
(\frac{a}{b})– looks cramped\left(\frac{a}{b}\right)– automatically sizes
Tools That Actually Help
Overleaf – Online LaTeX editor. No installation, live preview, great for beginners. Free tier is solid. Try Overleaf here.
Mathpix Snip – Take a screenshot of any equation (even handwritten), and it converts it to LaTeX. Absolute game-changer for converting textbook problems. Get Mathpix Snip.
Detexify – Draw a symbol, it tells you the LaTeX command. Saved me countless times. Access Detexify.
TeXstudio – If you want a desktop editor with autocomplete and error checking.
For a complete comparison of LaTeX editors across different platforms, check our guide on the best LaTeX editors.
Common Questions I Had (Maybe You Do Too)
Why does everyone hate eqnarray?
It’s old and has spacing issues. Use align instead. Seriously, pretend eqnarray doesn’t exist.
How do I stop equations from running off the page?
Use \allowbreak in long equations, or break them into multiple lines with align or multline. If you’re having layout issues, our page layout guide covers margin and spacing controls in detail.
What’s the difference between \[...\] and \begin{equation}?
\[...\] doesn’t number the equation. \begin{equation} does. Use equation* (with the asterisk) if you want the environment but no number.
Can I use LaTeX in Google Docs or Word?
Not natively. But you can use add-ons like “Auto-LaTeX Equations” for Google Docs. For serious work though, just use actual LaTeX.
The Reality Check
LaTeX isn’t magic. You’ll forget backslashes. You’ll mix up { and ( , and You’ll Google “latex integral limits” at 2 AM because you can’t remember if it’s ^ or _ first.
But once it clicks? The satisfaction of seeing perfectly formatted equations is weirdly addictive. You’ll start judging poorly formatted math in other people’s documents. You’ll become that person who suggests LaTeX to everyone.
And you know what? That’s totally fine.
Start Small, Build Up
Don’t try to write a perfect document on day one. Start with:
- A simple inline equation:
$x^2 + y^2 = z^2$ - A displayed equation:
\[ \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \] - A two-line align environment
Master those, then add complexity. Keep a cheat sheet of common symbols handy. You’ll memorize them naturally.
The learning curve is real, but it’s worth it. Welcome to the club.
Ready to explore more? Check out our complete LaTeX formatting commands guide for text styling and check out our LaTeX Hub for more.
