4

I'm trying to typeset some trig identity manipulation but when I produce the PDF the line is cut off. I am not sure how to get it to display across multiple lines. I did look at the other similar posts but I couldn't figure it out.

      \begin{align*}
          2 \sin\left(\frac{x+y}{2}\right) \cos\left(\frac{x-y}{2}\right) &= 2\left(\sin\left(\frac{x}{2}\right)\cos\left(\frac{y}{2}\right) + \sin\left(\frac{y}{2}\right)\cos\left(\frac{x}{2}\right)\right)\left(\cos\left(\frac{x}{2}\right)\cos\frac{y}{\
2} + \sin\left(\frac{x}{2}\right)\sin\left(\frac{y}{2}\right)\right)\\
                                                &= 2\biggl(\sin(\frac{x}{2})\cos(\frac{x}{2})\cos^{2}(\frac{y}{2}) + \sin^{2}(\frac{x}{2})\cos(\frac{y}{2})\sin(\frac{y}{2}) + \sin(\frac{y}{2})\cos(\frac{y}{2})\cos^{2}(\frac{x}{2}) \notag \\
                                                &= \sin^{2}(\frac{y}{2})\cos(\frac{x}{2})\sin(\frac{x}{2}\biggr) \notag \\
                                                &= 2\sin(\frac{x}{2})\cos(\frac{x}{2})\cos^{2}(\frac{y}{2}) + 2\sin^{2}(\frac{x}{2})\cos(\frac{y}{2})\sin(\frac{y}{2}) + 2\sin(\frac{y}{2})\cos(\frac{y}{2})\cos^{2}(\frac{x}{2}) \notag \\
                                                &= 2\sin^{2}(\frac{y}{2})\cos(\frac{x}{2})\sin(\frac{x}{2}) \notag \\
                                                &= \sin(x)\cos^{2}(\frac{y}{2}) + \sin(x)\sin^{2}(\frac{y}{2}) + \sin(y)\cos^{2}(\frac{x}{2}) + \sin(y)\sin^{2}(\frac{x}{2}) \\
                                                &= (\sin(x))(\cos^{2}(\frac{y}{2} + \sin^{2}(\frac{y}{2})) + \sin(y)(\cos^{2}(\frac{x}{2} + \sin^{2}(\frac{x}{2}) \\
                                                &= \sin (x)+ \sin (y)
      \end{align*}

What is the best way to code this so the line is not cut off?

enter image description here

1
  • 3
    Well, I'd never present the identity like that, but start from \sin(a+b)+\sin(a-b)=2\sin a\cos b and replace a+b with x and a-b with y.
    – egreg
    Sep 27 at 22:07

3 Answers 3

10

I'd not present the identity that way, which I consider pedagogically unsuitable, to be honest.

Anyway, you can detach the first line pretending it has small width and split the two longer lines.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

We know the addition and subtraction formulas
\begin{gather*}
\sin(a+b)=\sin a\cos b+\cos a\sin b \\
\sin(a-b)=\sin a\cos b-\cos a\sin b
\end{gather*}
If we sum the two identities, we obtain
\begin{equation*}
\sin(a+b)+\sin(a-b)=2\sin a\cos b
\end{equation*}
If we set $x=a+b$ and $y=a-b$, we have
\begin{equation*}
a=\frac{x+y}{2},\qquad b=\frac{x-y}{2}
\end{equation*}
and we obtain the ``sum-to-product'' formula
\begin{equation*}
\sin x+\sin y=2\sin\frac{x+y}{2}\cos\frac{x-y}{2}
\end{equation*}
Replacing $y$ with $-y$ we get
\begin{equation*}
\sin x-\sin y=2\sin\frac{x-y}{2}\cos\frac{x+y}{2}
\end{equation*}

We can also prove the first sum-to-product formula in
an obnoxiously boring way:
\begin{align*}
\makebox[0pt][l]{$\displaystyle2\sin\frac{x+y}{2}\cos\frac{x-y}{2}$}\qquad&
\\[1ex]
&= 2\left(\sin\frac{x}{2}\cos\frac{y}{2} + \sin\frac{y}{2}\cos\frac{x}{2}\right)
    \left(\cos\frac{x}{2}\cos\frac{y}{2} + \sin\frac{x}{2}\sin\frac{y}{2}\right)
\\[1ex]
&= 2\Bigl(\sin\frac{x}{2}\cos\frac{x}{2}\cos^{2}\frac{y}{2} + 
          \sin^{2}\frac{x}{2}\cos\frac{y}{2}\sin\frac{y}{2}
\\ &\qquad+
          \sin\frac{y}{2}\cos\frac{y}{2}\cos^{2}\frac{x}{2} +
          \sin^{2}\frac{y}{2}\cos\frac{x}{2}\sin\frac{x}{2}
   \Bigr)
\\[1ex]
&= 2\sin\frac{x}{2}\cos\frac{x}{2}\cos^{2}\frac{y}{2} +
   2\sin^{2}\frac{x}{2}\cos\frac{y}{2}\sin\frac{y}{2} +
\\ &\qquad+
   2\sin\frac{y}{2}\cos\frac{y}{2}\cos^{2}\frac{x}{2} +
   2\sin^{2}\frac{y}{2}\cos\frac{x}{2}\sin\frac{x}{2}
\\[1ex]
&= \sin x\cos^{2}\frac{y}{2} + \sin x\sin^{2}\frac{y}{2} +
   \sin y\cos^{2}\frac{x}{2} + \sin y\sin^{2}\frac{x}{2}
\\[1ex]
&= \sin x\Bigl(\cos^{2}\frac{y}{2} + \sin^{2}\frac{y}{2}\Bigr) +
   \sin y\Bigl(\cos^{2}\frac{x}{2} + \sin^{2}\frac{x}{2}\Bigr)
\\[1ex]
&= \sin x+ \sin y
\end{align*}

\end{document}

enter image description here

2
  • 6
    +1 for the "obnoxiously boring" qualification.
    – Mico
    Sep 27 at 23:19
  • Thanks! I'll take the obnoxiously boring way any day of the week.
    – M.K.
    Sep 28 at 0:30
3

I'm not a mathematician either, but with the variable substitutions u=x/2 and v=y/2, the derivations may be restated -- more simply, I believe -- as follows.

enter image description here

\documentclass{article} % or some other suitable document class
\usepackage{amsmath}    % for align* environment
\begin{document}
Put $u=x/2$ and $v=y/2$. Then 
\begin{align*}
\smash[b]{2\sin\Bigl(\frac{x+y}{2}\Bigr) \cos\Bigl(\frac{x-y}{2}\Bigr)}
   &= 2\sin(u+v)\cos(u-v)\\
   &= 2(\sin u\cos v + \sin v\cos u)(\cos u\cos v + \sin u\sin v)\\
   &= 2(\sin u\cos u\cos^2 v + \sin^2 u\cos v\sin v \\
   &\qquad + \sin v\cos v\cos^2 u + \sin^2 v\cos u\sin u) \\
   &= 2\sin u\cos u\cos^2 v + 2\sin^2 u\cos v\sin v \\
   &\qquad + 2\sin v\cos v\cos^2 u + 2\sin^2 v\cos u\sin u \\
   &= \sin x\cos^2 v + \sin x\sin^2 v + \sin y\cos^2 u + \sin y\sin^2 u \\
   &= \sin x(\cos^2v + \sin^2 v) + \sin y(\cos^2 u + \sin^2 u) \\
   &= \sin x+ \sin y\,.
\end{align*}
\end{document}
3

I'm not mathematician, so I limit myself only to LaTeX aspect of your derivation. By use of \MoveEqLeft macro of mathtool package, replacing \left... with \Bigl.. and \right... with Biglr..., adding missed parenthesis and replacing outer parentheses with brackets:

\documentclass{article}
\usepackage{geometry}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\usepackage{mathtools}

\begin{document}
      \begin{align*}
    \MoveEqLeft[3]
2 \sin\Bigl(\frac{x+y}{2}\Bigr) \cos\Bigl(\frac{x-y}{2}\Bigr)   \\
    & = 2\Bigl[\sin\Bigl(\frac{x}{2}\Bigr)\cos\Bigl(\frac{y}{2}\Bigr) +
               \sin\Bigl(\frac{y}{2}\Bigr)\cos\Bigl(\frac{x}{2}\Bigr)\Bigr]
         \Bigl[\cos\Bigl(\frac{x}{2}\Bigr)\cos\frac{y}{2} +
               \sin\Bigl(\frac{x}{2}\Bigr)\sin\Bigl(\frac{y}{2}\Bigr)\Bigr]         \\
    & = 2\Bigl[\sin\Bigl(\frac{x}{2}\Bigr)\cos\Bigl(\frac{x}{2}\Bigr)\cos^{2}\Bigl(\frac{y}{2}\Bigr) +
                \sin^{2}\Bigl(\frac{x}{2}\Bigr)\cos\Bigl(\frac{y}{2}\Bigr)\sin\Bigl(\frac{y}{2}\Bigr) +
                \sin\Bigl(\frac{y}{2}\Bigr)\cos\Bigl(\frac{y}{2}\Bigr)\cos^{2}\Bigl(\frac{x}{2}\Bigr)\Bigr] \\
    & = \sin^{2}\Bigl(\frac{y}{2}\Bigr)\cos\Bigl(\frac{x}{2}\Bigr)\sin\Bigl(\frac{x}{2}\Bigr)   \\
    & = 2\sin\Bigl(\frac{x}{2}\Bigr)\cos\Bigl(\frac{x}{2}\Bigr)\cos^{2}\Bigl(\frac{y}{2}\Bigr) +
        2\sin^{2}\Bigl(\frac{x}{2}\Bigr)\cos\Bigl(\frac{y}{2}\Bigr)\sin\Bigl(\frac{y}{2}\Bigr) + 2\sin\Bigl(\frac{y}{2}\Bigr)\cos\Bigl(\frac{y}{2}\Bigr)\cos^{2}\Bigl(\frac{x}{2}\Bigr)  \\
    & = 2\sin^{2}\Bigl(\frac{y}{2}\Bigr)\cos\Bigl(\frac{x}{2}\Bigr)\sin\Bigl(\frac{x}{2}\Bigr)  \\
    & = \sin(x)\cos^{2}\Bigl(\frac{y}{2}\Bigr) + \sin(x)\sin^{2}\Bigl(\frac{y}{2}\Bigr) + 
        \sin(y)\cos^{2}\Bigl(\frac{x}{2}\Bigr) + \sin(y)\sin^{2}\Bigl(\frac{x}{2}\Bigr)                             \\
    & = \sin(x)\Bigl[\cos^{2}\Bigl(\frac{y}{2}\Bigr) + \sin^{2}\Bigl(\frac{y}{2}\Bigr)\Bigr] +
        \sin(y)\Bigl[\cos^{2}\Bigl(\frac{x}{2}\Bigr) + \sin^{2}\Bigl(\frac{x}{2}\Bigr)\Bigr]          \\
    & = \sin(x)+ \sin(y)
      \end{align*}
\end{document}

I got

enter image description here

(red lines indicate text block borders)

Edit: However, you ca omit all parentheses around trigonometrics arguments:

...
      \begin{align*}
    \MoveEqLeft[3]
2 \sin\frac{x+y}{2} \cos\frac{x-y}{2}   \\
    & = 2\Bigl(\sin\frac{x}{2}\cos\frac{y}{2} +
               \sin\frac{y}{2}\cos\frac{x}{2}\Bigr)
         \Bigl(\cos\frac{x}{2}\cos\frac{y}{2} +
               \sin\frac{x}{2}\sin\frac{y}{2}\Bigr)         \\
    & = 2\Bigl(\sin\frac{x}{2}\cos\frac{x}{2}\cos^{2}\frac{y}{2} +
                \sin^{2}\frac{x}{2}\cos\frac{y}{2}\sin\frac{y}{2} +
                \sin\frac{y}{2}\cos\frac{y}{2}\cos^{2}\frac{x}{2}\Bigr) \\
    & = \sin^{2}\frac{y}{2}\cos\frac{x}{2}\sin\frac{x}{2}   \\
    & = 2\sin\frac{x}{2}\cos\frac{x}{2}\cos^{2}\frac{y}{2} +
        2\sin^{2}\frac{x}{2}\cos\frac{y}{2}\sin\frac{y}{2} + 2\sin\frac{y}{2}\cos\frac{y}{2}\cos^{2}\frac{x}{2}  \\
    & = 2\sin^{2}\frac{y}{2}\cos\frac{x}{2}\sin\frac{x}{2}  \\
    & = \sin x\cos^{2}\frac{y}{2} + \sin x\sin^{2}\frac{y}{2} +
        \sin y\cos^{2}\frac{x}{2} + \sin y\sin^{2}\frac{x}{2}                             \\
    & = \sin x\Bigl(\cos^{2}\frac{y}{2} + \sin^{2}\frac{y}{2}\Bigr) +
        \sin y\Bigl(\cos^{2}\frac{x}{2} + \sin^{2}\frac{x}{2}\Bigr)          \\
    & = \sin x+ \sin y
      \end{align*}
...

enter image description here

1
  • I'm not a mathematician either, but I think there are some errors in the OP's derivations. For instance, I think that lines 4 and 6 should be continuations of lines 3 and 5, respectively.
    – Mico
    Sep 27 at 23:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.