$A \cos (x) + B \sin(x)$ with $A,B \in \mathbb{R}$ but not necessarily positive

88 Views Asked by At

In this question, it is shown that

$$A \sin(x) + B \cos (x) = R \sin ( x + \theta )$$

for $A,B$ real and positive, with

$$R = \sqrt{A^2 + B^2}$$

$$\theta = \arctan \left( \frac{B}{A} \right)$$

This is performed solving the system

$$\left\{ \begin{array}{c} R \cos (\theta) = A\\ R \sin (\theta) = B \end{array} \right. $$

for $R$ and $\theta$. What if, instead, $A$ and/or $B$ are real, but not positive?

Some trivial test on WolframAlpha shows that the $\arctan \left( \frac{B}{A} \right)$ term is computed the same way, considering the sign of $A$ and $B$.

$R$ is instead negative if $A$ or both $A$ and $B$ are negative. It is obtained by squaring and summing the two equations in the system and I can't figure out how a sign can be considered in this operation.

6

There are 6 best solutions below

0
On BEST ANSWER

Let $A = R \cos \theta$ and $B = R \sin \theta$

So, $y = A \sin x + B \cos x = R \cos \theta \sin x+ R \sin \theta \cos x = R \sin(x + \theta)$

Also, $R^2 = A^2 + B^2$ or $R = \sqrt{A^2 + B^2}$

Let

$$\alpha = \tan^{-1} \left| \frac{B}{A} \right|$$

so that $\alpha \in [0,\pi/2]$

Let us assume $R$ to be always positive (conventional).

So we now have 4 cases.

CASE 1

$A \ge 0$ and $B \ge 0$

In this case, $R \cos \theta \ge 0$ and $R \sin \theta \ge 0$

Being $R>0$, this implies $\sin \theta \ge 0$ and $\cos \theta \ge 0$

So, $\theta \in [0 ,\pi/2]$

and

$$\alpha = \theta$$


CASE2

$A \le 0$ and $B \ge 0$

In this case, $R \cos \theta \le 0$ and $R \sin \theta \ge 0$

As $R>0$, $\sin \theta \ge 0$ and $\cos \theta \le 0$

So, $\theta \in [ \pi/2, \pi]$

$\alpha = \pi - \theta$

or $$\theta = \pi - \alpha$$


CASE3

$A \le 0$ and $B \le 0$

In this case, $R \cos \theta \le 0$ and $R \sin \theta \le 0$

As $R>0$, $\sin \theta \le 0$ and $\cos \theta \le0$

So, $\theta \in [ \pi, 3\pi/2]$ or $\theta \in [ -\pi/2, -\pi]$.

$$\alpha = \theta - \pi$$

or $$\theta = \alpha + \pi$$


CASE4

$A \ge 0$ and $B \le 0$

In this case, $R \cos \theta \ge 0$ and $R \sin \theta \le 0$

As $R>0$, $\sin \theta \le 0$ and $\cos \theta \ge 0$

So, $\theta \in [3\pi/2, 2\pi]$ or $\theta \in [-\pi/2,0]$.

$$\alpha = - \theta$$

or

$$ \theta = - \alpha$$


So, at last $$y = R \sin( x + \theta)$$

Find the signs of $A$ and $B$, then the principal value $\alpha$. Then according to the quadrant, find $\theta$ in terms of $\alpha$ and substitute in the above expression.

0
On

Take $\theta=\arccos\frac AR$. Then$$\sin^2\theta=1-\cos^2\theta=1-\frac{A^2}{R^2}=\left(\frac BR\right)^2$$amd therefore $R\sin\theta=\pm\frac BR$. If $R\sin\theta=\frac BR$, then that $\theta$ will do. Otherwise, take $-\theta$ instead.

1
On

Write your term in the form $$\sqrt{A^2+B^2}\left (\frac{A\cos(x)}{\sqrt{A^2+B^2}}+\frac{B\sin(x)}{\sqrt{A^2+B^2}}\right)$$

2
On

$\newcommand{arccot}{\operatorname{arccot}}$A method is, for all $A,B\in\Bbb R$ such that $A\ne 0\lor B\ne 0$, to consider the following manipulation $$\sqrt{A^2+B^2}\left(\frac A{\sqrt{A^2+B^2}}\sin x+\frac{B}{\sqrt{B^2+A^2}}\cos x\right)=\\=\sqrt{A^2+B^2}\sin\left(x+\theta\left(\frac A{\sqrt{A^2+B^2}},\frac {B}{\sqrt{A^2+B^2}}\right)\right)$$

where $\theta(c,s)$ is, provided that $c^2+s^2=1$, the one and only real number $\theta\in (-\pi,\pi]$ such that $\cos \theta=c\land \sin\theta=s$. There are a number of ways to write such number. Here are a few:

\begin{align}\theta(c,s)&=\begin{cases}\arccos c&\text{if }s\ge 0\\ -\arccos c&\text{if }s<0\end{cases}\\ \theta(c,s)&=\begin{cases}\arctan \frac sc&\text{if }c> 0\\ -\frac\pi2\operatorname{sgn}s&\text{if }c=0\\ \pi+\arctan \frac sc&\text{if }c<0\land s\ge 0\\ -\pi+\arctan\frac sc&\text{if }c<0\land s<0\end{cases}\\ \theta(c,s)&=\begin{cases}\arccot \frac cs&\text{if }s> 0\\ \pi\operatorname{sgn}c&\text{if }s=0\\ -\arccot c&\text{if }s<0\end{cases}\end{align}

Of course, a different choice of range for $\theta(c,s)$ (for instance $[0,2\pi)$) may yield different expressions.

0
On

For $R$ the signs of $A$ and $B$ do not matter at all.

To get a correct angle for any $(A,B) \ne (0,0)$ you may have a look at the 2-argument arctangent function: $$θ=\rm{atan2}(B, A).$$

For each case in its definition you get the same signs as in your tests with WolframAlpha:

Case $A > 0$: $$R \sin\left(x + \rm{atan2}(B, A)\right) = R \sin\left(x + \arctan\left(\frac A B\right)\right)$$ Case $A < 0$: $$R \sin(x + \rm{atan2}(B, A)) = R \sin\left(x + \arctan\left(\frac A B\right) \pm \pi\right) = -R \sin\left(x + \arctan\left(\frac A B\right)\right)$$

Case $A = 0$ and $B > 0$: $$R \sin\left(x + \rm{atan2}(B, 0)\right) = R \sin\left(x + \frac \pi 2\right) = R \cos(x) = B \cos(x)$$ Case $A = 0$ and $B < 0$: $$R \sin\left(x + \rm{atan2}(B, 0)\right) = R \sin\left(x - \frac \pi 2\right) = -R \cos(x) = B \cos(x)$$

1
On

A simpler way of solving this, without restrictions or polar coordinates, is the following:

If $A=0$ there is nothing to prove. Otherwise: $$A \sin(x) + B \cos (x) =A \left( \sin(x) + \frac{B}{A} \cos (x) \right)$$

Now, let $\tan(\theta)=\frac{B}{A}$. Then $$A \sin(x) + B \cos (x) =A \left( \sin(x) + \tan(\theta)\cos (x) \right)=A \left( \sin(x) + \frac{\sin(\theta)}{\cos(\theta)}\cos (x) \right)\\=A \frac{ \sin(x)\cos(\theta) + \sin(\theta)\cos(x)}{\cos(\theta)}=\frac{A}{\cos(\theta)}\sin(x+\theta)$$