3

I have an equation which I rearrange in several steps. I want to show this, by having a single numbered equation, which has an aligned equal sign on the right, and the terms left of the equal sign are centered in each line. So basically it looks like this:

        (a+b)^3       =
     (a+b)(a+b)^2     = 
   (a+b)(a+b)(a+b)    =   (1)
  (a^2+2ab+b^2)(a+b)  =
(a^3+3a^2b+3ab^2+b^3) =

I know about aligned, gather and split, but neither seems to achieve, what I want.

Update: This is no duplicate to the linked question, as I want a fixed sign on the right, and a horizontal centered alignement on the left. The linked question has no horizontal centering in it.

2
  • 1
    @Sebastiano: This question is significanlty different from the one you cited.
    – GuM
    Apr 13, 2018 at 22:31
  • I thus have understood in this mode. If I'm wrong, I try to reopen the question as it should be. Now there is reopen (1).
    – Sebastiano
    Apr 14, 2018 at 19:39

1 Answer 1

7

You can do it with an array. I suggest also another method for laying out the computation.

\documentclass{article}
\usepackage{amsmath,array}

\begin{document}

\begin{equation}
\renewcommand{\arraystretch}{1.2}
\setlength{\arraycolsep}{0pt}
\begin{array}{c >{{}}c}
        (a+b)^3       &= \\
     (a+b)(a+b)^2     &= \\
   (a+b)(a+b)(a+b)    &= \\
  (a^2+2ab+b^2)(a+b)  &= \\
(a^3+3a^2b+3ab^2+b^3) 
\end{array}
\end{equation}

\begin{equation}
\begin{aligned}
(a+b)^3
&=(a+b)(a+b)^2 \\
&=(a+b)(a^2+2ab+b^2) \\
&=a^3+2a^2b+ab^2+a^2b+2ab^2+b^3 \\
&=a^3+3a^2b+3ab^2+b^3
\end{aligned}
\end{equation}

\end{document}

enter image description here

2
  • Thanks for the suggestion. Although I asked for something different, I'm gonna use the 2nd option as it looks indeed nicer. :-) Apr 13, 2018 at 22:46
  • 1
    @egreg Excuse me and the OP infinitezero. If I made a mistake, I voted to reopen the issue.
    – Sebastiano
    Apr 14, 2018 at 19:40

You must log in to answer this question.

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