# Show the Steps Taken to Solve an Equation

I am new to LaTex and I am trying to type a document where I show the steps I took to solve an equation however I do not know how to do this in LaTex. I am trying to display something like this:

 x^2+2x+1 = 0 (x+1)^2 = 0 x = -1

Is there a way to do this (or something similar) in LaTex? Any suggestions would be much appreciated!

-

## migrated from stackoverflow.comMay 5 '12 at 13:35

This question came from our site for professional and enthusiast programmers.

You should consider using amsmath:

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{align*}
x^2 + 2x + 1 &= 0 \\
(x+1)^2 &= 0 \\
\llap{$\rightarrow$\hspace{50pt}} x &= -1
\end{align*}
\end{document}

-
Perhaps \implies would be a better then using \rightarrow. –  Peter Grill May 5 '12 at 18:01

Try this:

\begin{eqnarray}
x^2+2x+1 &=& 0      \nonumber \\
(x+1)^2  &=& 0 \nonumber \\
x & = & -1
\end{eqnarray}


You might want to number each step by removing the \nonumber commands; I only numbered the last one.

More examples here.

-
eqnarray should never be used, see e.g. \eqnarray vs \align –  Torbjørn T. May 5 '12 at 14:10
Welcome to TeX.sx! Your answer was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or edit your answer. –  Werner May 5 '12 at 14:23
There we go! Guess my Latex-Fu is outdated, thanks for the heads up! –  dario_ramos May 6 '12 at 22:17