B Trigonometric Identity involving sin()+cos()

AI Thread Summary
The discussion centers on the application of a trigonometric identity involving sine and cosine to a specific equation. The identity is given as a combination of terms, but issues arise due to the signs of the coefficients, particularly when one coefficient is negative. Participants highlight the importance of correctly determining the angle φ using the arctangent function, noting that it must account for the signs of both coefficients to avoid discrepancies in results. The correction involves recognizing that the identity should include a sign factor based on the coefficient a, which affects the amplitude and phase angle. Ultimately, understanding these nuances is crucial for accurate plotting and interpretation of the equation.
erobz
Gold Member
Messages
4,445
Reaction score
1,839
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 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 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 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 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 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 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 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 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 FactChecker and erobz

Similar threads

Replies
5
Views
1K
Replies
5
Views
1K
Replies
2
Views
1K
Replies
2
Views
1K
Replies
7
Views
1K
Replies
1
Views
11K
Replies
5
Views
1K
Replies
10
Views
1K
Back
Top