Trigonometric Identity involving sin()+cos()

Click For Summary

Discussion Overview

The discussion revolves around the application of a trigonometric identity involving sine and cosine functions, specifically in the context of a physics problem related to motion. Participants explore the identity's implications, its application to a specific equation, and the potential pitfalls in its use, particularly concerning the signs of the coefficients involved.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant applies the identity $$ a \cos ( \omega t ) + b \sin ( \omega t ) = \sqrt{a^2+b^2} \cos ( \omega t - \phi )$$ to a specific equation but finds discrepancies in the plotted results.
  • Another participant suggests that the issue may stem from the inability of the angle $$\phi = \tan^{-1} \left( \frac{b}{a} \right)$$ to distinguish between positive and negative values of $$a$$ and $$b$$.
  • Some participants note that the right-hand side of the identity remains the same regardless of the signs of $$a$$ and $$b$$, while the left-hand side is affected by these signs.
  • There is a correction proposed regarding the identity, indicating it should include a sign factor: $$ a \cos ( \omega t ) + b \sin ( \omega t ) = sgn(a) \sqrt{a^2+b^2} \cos ( \omega t - \phi )$$.
  • Discussion includes the assumption that amplitude $$A$$ is positive, which may not always be explicitly stated in texts.
  • One participant elaborates on the implications of assuming $$a > 0$$ and provides a detailed derivation of the identity under this assumption, addressing the behavior when $$a < 0$$.
  • Another participant emphasizes the importance of considering the quadrant when determining $$\phi$$ and suggests using the $$atan2$$ function to avoid sign issues.

Areas of Agreement / Disagreement

Participants express differing views on the correct application of the trigonometric identity, particularly regarding the treatment of signs and the definition of $$\phi$$. There is no consensus on a single correct approach, as multiple interpretations and corrections are proposed.

Contextual Notes

Participants highlight potential limitations in the original identity's assumptions, particularly regarding the signs of coefficients and the implications for amplitude. The discussion reveals that the mathematical steps and definitions may not be universally agreed upon.

erobz
Gold Member
Messages
4,459
Reaction score
1,846
I'm trying to use the following trigonometric identity:

$$ a \cos ( \omega t ) + b \sin ( \omega t ) = \sqrt{a^2+b^2} \cos ( \omega t - \phi )$$ Where ##\phi = \tan^{-1} \left( \frac{b}{a} \right)## for the following equation:

$$ x(t) = -\frac{g}{ \omega^2} \cos ( \omega t) + \frac{v_o}{ \omega } \sin ( \omega t ) + \frac{g}{ \omega^2} $$

When I apply the identity I get:

##a = -\frac{g}{ \omega^2}##
##b = \frac{v_o}{ \omega }##
##\phi = \tan^{-1} \left( \frac{-v_o \omega}{g} \right)##

$$ X(t) = \sqrt{\left( \frac{g}{ \omega^2} \right)^2+\left( \frac{v_o}{ \omega } \right)^2} \cos \left( \omega t - \tan^{-1} \left( \frac{-v_o \omega}{g} \right) \right) + \frac{g}{ \omega^2} $$

However, on a plot they are not matching up...What am I doing wrong?

Mass-Spring Oscillator.JPG
 
Mathematics news on Phys.org
I suspect it may be related to the fact that
##\phi = \tan^{-1} \left( \frac{b}{a} \right)## can't distinguish ##\frac{b}{a}## from ##\frac{-b}{-a}##.
Try https://en.wikipedia.org/wiki/Atan2
or add ##\pi## to the result of ##\tan^{-1}## if the x-component is negative.
 
  • Like
Likes   Reactions: erobz and topsquark
You can see from your original equation that CORRECTION the right-hand side is the same no matter what the signs of ##a## and ##b## are, whereas the left-hand side is different when a sign of ##a## or ##b## changes. Your plot of the right-hand side is correct for a positive ##a##, but your example has a negative ##a=-g/\omega^2##.
CORRECTION: I overlooked that ##\phi## of the right-hand side depends on the signs of ##a## and ##b##.
 
Last edited:
  • Like
Likes   Reactions: erobz, PeroK and topsquark
erobz said:
I'm trying to use the following trigonometric identity:

$$ a \cos ( \omega t ) + b \sin ( \omega t ) = \sqrt{a^2+b^2} \cos ( \omega t - \phi )$$ Where ##\phi = \tan^{-1} \left( \frac{b}{a} \right)## for the following equation:
This is not quite right. According to Wikipedia, it should be:
$$ a \cos ( \omega t ) + b \sin ( \omega t ) = sgn(a) \sqrt{a^2+b^2} \cos ( \omega t - \phi )$$ Where ##\phi = \tan^{-1} \left( \frac{b}{a} \right)##.

https://en.wikipedia.org/wiki/List_of_trigonometric_identities#Linear_combinations
 
  • Like
Likes   Reactions: topsquark and erobz
I read the identity from my Mechanical Measurements Text:

Perhaps they are assuming something about ##A,B##, but I don't see it anywhere.

IMG_1739.jpg
 
erobz said:
I read the identity from my Mechanical Measurements Text:

Perhaps they are assuming something about ##A,B##, but I don't see it anywhere.

View attachment 315809
If ##A## is taken to be the amplitude (##y(0) = A##), then tacitly ##A > 0##.
 
  • Like
Likes   Reactions: topsquark
FactChecker said:
You can see from your original equation that CORRECTION the right-hand side is the same no matter what the signs of ##a## and ##b## are, whereas the left-hand side is different when a sign of ##a## or ##b## changes. Your plot of the right-hand side is correct for a positive ##a##, but your example has a negative ##a=-g/\omega^2##.
CORRECTION: I overlooked that ##\phi## of the right-hand side depends on the signs of ##a## and ##b##.
You were right if you looked at the case where ##t = 0##, as ##\cos## is positive on the range of ##\tan^{-1}##, which is ##(-\frac \pi 2, \frac \pi 2)##:
$$a = \sqrt{a^2 + b^2}\cos(-\phi) = \sqrt{a^2 + b^2}\cos(\phi)> 0$$
 
  • Like
Likes   Reactions: topsquark
PeroK said:
If ##A## is taken to be the amplitude (##y(0) = A##), then tacitly ##A > 0##.
But wouldn't the amplitude be ##\sqrt{ A^2 + B^2}## ?
 
  • Like
Likes   Reactions: topsquark and PeroK
  • #10
erobz said:
But wouldn't the amplitude be ##\sqrt{ A^2 + B^2}## ?
That's true. The important thing is to remember the mathematical pitfall you uncovered here. It's possible the book's author overlooked it.
 
  • Like
Likes   Reactions: topsquark and erobz
  • #11
First, assume ##a > 0## and let ##\phi = \tan^{-1}\big (\frac b a \big )##. Note that ##-\frac \pi 2 < \phi < \frac \pi 2##. Hence: ##\cos \phi > 0## and ##\sin \phi## has the same sign as ##b##. We have:
$$\cos(x - \phi) = \cos x \cos \phi + \sin x \sin \phi$$Where
$$\cos \phi = \sqrt{\cos^2 \phi} = \frac 1 {\sqrt{\sec^2 \phi}} = \frac 1 {\sqrt{1 + \tan^2 \phi}} = \frac 1 {\sqrt{1 + \frac{b^2}{a^2}}} = \frac{a}{\sqrt{a^2 + b^2}}$$And:
$$\sin \phi = sgn(b) \sqrt{\sin^2 \phi} = sgn(b) \sqrt{1 - \cos^2 \phi} = sgn(b)\sqrt{1 - \frac{1}{\sec^2 \phi}}$$$$ = sgn(b)\sqrt{\frac{b^2}{a^2 + b^2}} = \frac{b}{\sqrt{a^2+b^2}}$$Hence, for ##a > 0## we have:
$$\cos(x - \phi) = \frac 1 {\sqrt{a^2 + b^2}}\big(a\cos x + b\sin x\big)$$And$$a\cos x + b\sin x = \sqrt{a^2 + b^2}\cos(x - \phi)$$Finally, if ##a < 0##, then:
$$a\cos x + b\sin x = -\big((-a)\cos x + (-b)\sin x \big ) = -\sqrt{a^2 + b^2}\cos(x - \phi)$$Where ##\phi = \tan^{-1}\big(\frac{-b}{-a} \big) = \tan^{-1}\big(\frac{b}{a} \big)##
 
  • Like
Likes   Reactions: erobz and topsquark
  • #12
It is really common for people to be sloppy when they say ##\phi = tan^{-1}(b/a)##. As others have said, there are sign issues depending on which quadrant you are in. When things seem wrong always look at a sketch in the complex plane first. This is why all (good) programming libraries have the atan2 function. Also, beware, you'll see this mistake again, from yourself or others.
 
  • Like
Likes   Reactions: FactChecker and erobz

Similar threads

  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 10 ·
Replies
10
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
4
Views
1K
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K