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.

3 Answers 3

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.

2
  • Is it possible to make the vertical spacing between the two answers smaller? I don't need them to take 4 times the height of the original equation.
    – Shai Avr
    Feb 28 at 12:55
  • @ShaiAvr yes, I updated the answer with less spacing.
    – Ubiquitous
    Feb 28 at 13:08
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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .