2

When I solve a quadratic equation, I usually like to split the two answers with arrows like this:

How can I achieve this style with Latex? I am also open to an alternative visually appealing style if you can suggest one.

Ubiquitous
  • 2,566
Shai Avr
  • 715

3 Answers3

6

You can do this with TikZ:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture} \node(formula){$x_{1,2}=\frac{-2\pm\sqrt{2^2-4\cdot1\cdot(-15)}}{2}=\frac{-2\pm\sqrt{64}}{2}=\frac{-2\pm8}{2}$}; \node(solution1) [above right =-0.5em and 2em of formula]{$x_1=\frac{-2+8}{2}=3$}; \node(solution2) [below right =-0.5em and 2em of formula]{$x_2=\frac{-2-8}{2}=-5$}; \draw [->] (formula.east) to [out=0, in=180] (solution1.west); \draw [->] (formula.east) to [out=0, in=180] (solution2.west); \end{tikzpicture}

\end{document}

enter image description here

To get an understanding of how this works, I recommend looking at the example walk-throughs in the PGF-TikZ manual.

Ubiquitous
  • 2,566
6

Without TikZ (update : Following NBur's reply, I have changed the position of the &). For the choice between cases and array, an interesting answer is given by : Cases vs. Array environments .

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
x_{1,2}=\frac{-2\pm\sqrt{2^2-4\cdot1\cdot(-15)}}{2}=\frac{-2\pm\sqrt{64}}{2}=\frac{-2\pm8}{2} = \left\{ \begin{array}{cl}
x_1&=\dfrac{-2+8}{2}=3\\
x_2&=\dfrac{-2-8}{2}=-5\\
\end{array}\right.
\end{equation*}
\end{document}

enter image description here

Alain Matthes
  • 95,075
6

Without TikZ, but with cases and prettier alignment

\documentclass{article}
\usepackage{amsmath}
\begin{document}
  \begin{equation*}
    x_{1,2}=\frac{-2\pm\sqrt{2^2-4\cdot1\cdot(-15)}}{2}=\frac{-2\pm\sqrt{64}}{2}=\frac{-2\pm8}{2} = \begin{cases}
      x_1=\dfrac{-2+8}{2}=3\\[1ex]
      x_2=\dfrac{-2-8}{2}=-5
    \end{cases}
  \end{equation*}
\end{document}

enter image description here

NBur
  • 4,326
  • 10
  • 27