My friend evaluated this to be $$ \int \bigl| a\sin(x)+b\cos(x) \bigr| {\rm d}x \\ = \sqrt{a^2+b^2} \left( \sin(x-\phi)\text{sign}(\cos(x-\phi)) +\frac{2}{\pi} \bigl(x-\arctan(\tan(x-\phi)) \bigr) \right) + C $$ where $\phi = \arctan \left(\frac{a}{b} \right)$.

My answer instead is much shorter, by simply looking for the intervals of $x$ for which I need to multiply by $-1$, I got

$$ (b\sin(x)-a\cos(x)) \cdot \text{sign}(a\sin(x)+b\cos(x)) + C $$

Why does my friend's solution look so big and complex and how did she even come up with the idea to do that?

  • 1
    $\begingroup$ Try $b=1$, $a=0$, then you suggest $\sin x\cdot\text{sign}\,\cos x$ as the antiderivative, but it is not even continuous at some points. $\endgroup$ – A.Γ. Jan 2 at 16:23
  • 2
    $\begingroup$ What exactly is the point of the $\frac{\sqrt{\cos^2(x-\phi)}}{\cos(x-\phi)}$? It could be replaced by $\text{sign}(\cos(x-\phi))$. $\endgroup$ – John Doe Jan 2 at 16:23
  • $\begingroup$ @A.Γ. The other solution actually also gives $\sin x \cdot \text{sign} \cos x$ in that case $\endgroup$ – John Doe Jan 2 at 16:27
  • $\begingroup$ @JohnDoe Not really, it has the extra term with $\arctan$ that shifts the function in different intervals by a multiple of $2$ to make it continuous. $\endgroup$ – A.Γ. Jan 2 at 16:43
  • $\begingroup$ @A.Γ. Ah yes, you're right. $\endgroup$ – John Doe Jan 2 at 16:44

She is probably starting by replacing the $a\sin x + b\cos x$ and rewriting in terms of a function with an amplitude and phase. One way to do this is to multiply by $1$ and draw a right triangle with angle $\phi$, adjacent side length $b$, and opposite side length $a$. Then one has

$$\begin{aligned} \left|a\sin x + b\cos x\right| &= \sqrt{a^{2}+b^{2}}\left|\frac{a}{\sqrt{a^{2}+b^{2}}}\,\sin x + \frac{b}{\sqrt{a^{2}+b^{2}}}\,\cos x\right| \\ &= \sqrt{a^{2}+b^{2}}\left|\sin\phi\sin x + \cos\phi\cos x\right| \\ &= \sqrt{a^{2}+b^{2}}\left|\cos(x-\phi)\right|.\end{aligned}$$

This procedure is motivated in physics/engineering as a more elegant way of writing solutions to the harmonic oscillator equation, as amplitude and phase both have physical interpretations and are often easier to determine given initial conditions.


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.