$A\cos(\theta) + B\sin(\theta)$ for complex $A,B$

The relationship given in \ref{22} below (highlighted) is derived as follows:

$$\vec{Z} = \vec{A} \cos(\theta) + \vec{B} \sin(\theta) \tag{1} \label{1a}$$

With $ \vec{Z}, \vec{A}, \vec{B} \in \mathbb{C}$ as:

$$\vec{A} = \alpha + j\delta \tag{2} \label{2}$$ $$\vec{B} = \beta + j\epsilon \tag{3} \label{3}$$

With $\alpha, \beta, \delta, \epsilon, \theta \in \mathbb{R} $

Using the relationships $\cos(\theta) = (e^{j\theta}+e^{-j\theta})/2$ and $\sin(\theta) =(e^{j\theta}-e^{-j\theta})/(2j)$ in \ref{1a} results in:

$$Z = (\alpha + j\delta)\frac{e^{j\theta}+e^{-j\theta}}{2} + (\beta + j\epsilon)\frac{e^{j\theta}-e^{-j\theta}}{2j} $$

$$ = \frac{1}{2}e^{j\theta}((\alpha + \epsilon)+j(\delta-\beta)) + \frac{1}{2}e^{-j\theta}((\alpha - \epsilon)+j(\delta+\beta))$$

$$ = e^{j\theta}V_1e^{j\phi_1} + e^{-j\theta}V_2e^{j\phi_2} \tag{4} \label{4}$$

With $V_1, V_2 \in \mathbb{R}$ as

$$2V_1e^{j\phi_1} = ((\alpha + \epsilon)+j(\delta-\beta))\tag{5} \label{5}$$

$$2V_2e^{j\phi_2} = ((\alpha - \epsilon)+j(\delta+\beta))\tag{6} \label{6}$$

From \ref{5}, \ref{6}:

$$2V_1 = \sqrt{(\alpha+\epsilon)^2+(\delta-\beta)^2}\tag{7} \label{7}$$

$$\phi_1 = \text{atan2}(\delta-\beta, \alpha+ \epsilon)\tag{8} \label{8}$$

$$2V_2 = \sqrt{(\alpha-\epsilon)^2+(\delta+\beta)^2}\tag{9} \label{9}$$

$$\phi_2 = \text{atan2}(\delta+\beta, \alpha- \epsilon)\tag{10} \label{10}$$

Also note the following:

$$\vec{A}-j\vec{B} = \alpha + j\delta - j(\beta + j\epsilon) = (\alpha + \epsilon) + j(\delta - \beta) = 2V_1e^{j\phi_1} \tag{11} \label{11}$$

$$\vec{A}+j\vec{B} = \alpha + j\delta + j(\beta + j\epsilon) = (\alpha - \epsilon) + j(\delta + \beta) = 2V_2e^{j\phi_2} \tag{12} \label{12}$$

As a verification of the relationships derived thus far, we view the following geometric graphic showing an example $\vec{A}$, $\vec{B}$ in the first quadrant for $\theta = 0$ showing the resulting vectors from \ref{11} and \ref{12}:

theta = 0

Which is consistent with the the relationship from \ref{1a} and \ref{4} for $\theta =0$:

$$\vec{Z} = \vec{A}\cos(\theta)+\vec{B}\sin(\theta) = \vec{A}\cos(0)+B\sin(0) = \vec{A}$$ $$\vec{Z} = e^{j\theta}V_1e^{j\phi_1} + e^{-j\theta}V_2e^{j\phi_2} = e^{j0}V_1e^{j\phi_1} + e^{-j0}V_2e^{j\phi_2}= V_1e^{j\phi_1} + V_2e^{j\phi_2} $$

With $\theta =0$ the above solution is trivial resulting in $\vec{A}$ as expected, but we can use this graphic to recognize what would occur for increasing $\theta$ and how to then frame the problem to describe the final result as a sinusoid plus an exponential. This is demonstrated starting with the graphic immediately below which shows the vectors reduced by half as in the equation for $\vec{Z}$ and adds a positive valued $\theta$, where the final result $\vec{Z}$ would be the sum of the two blue vectors shown.

Z with theta

We can then decompose this into complex conjugate vectors (sinusoid), and complex phase components by viewing the larger of the two vectors as a sum of a vector of identical magnitude to the smaller vector plus a residual, and then finding the bisecting angle between these two vectors since they would be in complex conjugate phase from that angle:

identifying components

Resulting in the following decomposition:

decomposition

As the above graphics illustrate,

$$\vec{Z} = e^{j\bar\phi}\big(2V_2\cos(\gamma)+(V_1-V_2)e^{-j\gamma}\big) \tag{13} \label{13}$$

where

$$\bar\phi = \frac{\phi_2+\phi_1}{2} \tag{14} \label{14}$$

$$\gamma = \phi_2+\theta - \bar\phi = \theta + \frac{\phi_2-\phi_1}{2} \tag{15} \label{15} $$

Using \ref{15} in \ref{13}:

$$ \vec{Z} = e^{j\bar\phi}\bigg(2V_2\cos(\theta + \phi_\Delta/2)+ (V_1-V_2)e^{-j(\theta + \phi_\Delta/2)}\bigg) \tag{16} \label{16}$$

Where

$$\phi_\Delta = \phi_2-\phi_1$$

with $\phi_1$ and $\phi_2$ as given in \ref{8} and \ref{10}, and $V_1$ and $V_2$ as given in \ref{7} and \ref{9}.

From \ref{16}:

$$ \vec{Z} =2V_2 e^{j\bar\phi} \cos(\theta + \phi_\Delta/2) + (V_1-V_2)e^{-j(\theta + \phi_\Delta/2 - \bar\phi)}\tag{17} \label{17}$$

Note that the argument:

$$\theta + \phi_\Delta/2 - \bar\phi = \theta + \frac{(\phi_2-\phi_1)}{2} - \frac{(\phi_1+\phi_2)}{2} = \theta - \phi_1$$

Which is consistent with the figure, thus \ref{17} simplifies further to:

$$\vec{Z} = 2V_2 e^{j\bar\phi}\cos(\theta + \phi_\Delta/2) + (V_1-V_2)e^{-j(\theta -\phi_1)}\tag{18} \label{18}$$

This is put into the original units of $\vec{A}, \vec{B}$ as follows:

From \ref{11} and \ref{12} and depicted in the first graphic:

$$V_1 = \frac{\Vert\vec{A}-j\vec{B}\Vert}{2} \tag{19} \label{19}$$

$$V_2 = \frac{\Vert\vec{A}+j\vec{B}\Vert}{2}\tag{20} \label{20}$$

From which we get:

$$V_1-V_2 =\frac{\Vert\vec{A}-j\vec{B}\Vert-\Vert\vec{A}+j\vec{B}\Vert}{2}\tag{21} \label{21}$$

By substituting \ref{20} and \ref{21} in \ref{17} we get the final result:

$$ \bbox[yellow]{\vec{Z} =\vec{A}\cos(\theta)+\vec{B}\sin(\theta) = \\ \Vert\vec{A}+j\vec{B}\Vert e^{j\bar\phi}\cos(\theta + \phi_\Delta/2) + \frac{\Vert\vec{A}-j\vec{B}\Vert-\Vert\vec{A}+j\vec{B}\Vert}{2}e^{-j(\theta -\phi_1)}}\tag{22} \label{22}$$

The angle $\bar\phi$ is the bisecting angle of $V_1e^{j\phi_1}$ and $V_2e^{j\phi_2}$ which is determined by normalizing both:

$$\bar\phi = \frac{1}{2}\arg\bigg(\frac{\vec{A}-j\vec{B}}{\Vert\vec{A}-j\vec{B}\Vert}+\frac{\vec{A}+j\vec{B}}{\Vert\vec{A}+j\vec{B}\Vert}\bigg) \tag{23} \label{23}$$

Similarly we could multiply the inner expression by $\Vert\vec{A}+j\vec{B}\Vert \Vert\vec{A}-j\vec{B}\Vert$ which is just a scaling so does not change the argument but results in this alternate relationship:

$$\bar\phi = \frac{1}{2}\arg\bigg(\frac{\vec{A}-j\vec{B}}{\Vert\vec{A}+j\vec{B}\Vert} + \frac{\vec{A}+j\vec{B}}{\Vert\vec{A}-j\vec{B}\Vert}\bigg) \tag{24} \label{24}$$

Perhaps simpler is just the sum of the angles derived from \ref{11} and \ref{12} to be:

$$ \bar\phi = \frac{\arg(\vec{A}+j\vec{B})+\arg(\vec{A}-j\vec{B})}{2} \tag{25} \label{25}$$

resulting in:

$$\bbox[yellow]{\bar\phi = \frac{\text{atan2}(\delta+\beta, \alpha-\epsilon)+ \text{atan2}(\delta-\beta,\alpha+\epsilon)}{2}}\tag{26} \label{26}$$

And similarly for $\phi_\Delta$:

$$\frac{\phi_\Delta}{2} = \frac{1}{2}\arg\bigg(\frac{\vec{A}+j\vec{B}}{\Vert\vec{A}-j\vec{B}\Vert}-\frac{\vec{A}-j\vec{B}}{\Vert\vec{A}+j\vec{B}\Vert}\bigg) \tag{27} \label{27}$$

or equivalently from \ref{11} and {12} as done in \ref{26}:

$$\frac{\phi_\Delta}{2} = \frac{\arg(\vec{A}+j\vec{B})-\arg(\vec{A}-j\vec{B})}{2} \tag{28} \label{28}$$

resulting in:

$$\bbox[yellow]{\frac{\phi_\Delta}{2} = \frac{\text{atan2}(\delta+\beta, \alpha-\epsilon)- \text{atan2}(\delta-\beta,\alpha+\epsilon)}{2}}\tag{29} \label{29}$$

And from \ref{11}:

$$\bbox[yellow]{\phi_1 = \arg(\vec{A}-j\vec{B})=\text{atan2}(\delta-\beta,\alpha+\epsilon)}\tag{30} \label{30}$$

Thus \ref{22} with \ref{26}, \ref{29}, and \ref{30} we have a relationship similar to $A\cos(\theta) + B\sin(\theta)= \sqrt{A^2+B^2}cos(\theta + \gamma)$ expanded for complex $A, B$. I still need to confirm the final result is accurate and it can be further simplified. (so still working on it when I can get back to this, and encourage others to post other derivations that can get to this result more concisely).

UPDATE: S.H.W.'s solution is the simple and elegant solution I was looking for that this (if correct) will be equivalent to (I just couldn't see at first how simple it was). Note if we selected a circle or radius $(V_1+V_2)/2$ as reference in the red circled figure (third graphic) this would result in a rotated real and imaginary sine wave matching that result. I will eventually update this to show the graphics and the solution with a reference using the inner, outer and average radius.


Additional equations that may or may not help above:

I don't see how the following helps yet but including for reference case it leads to further simplification:

Note that the inner terms of \ref{22} and \ref{23} represent the sides of a parallelogram that have been normalized and therefore the magnitude of this summation from the generalized relationship $c^2 = a^2+b^2-2ab\cos(\text{angle})$ of the sides to the diagonal for a parallelogram equals:

$$\bigg\Vert\frac{\vec{A}-j\vec{B}}{\Vert\vec{A}+j\vec{B}\Vert} + \frac{\vec{A}+j\vec{B}}{\Vert\vec{A}-j\vec{B}\Vert}\bigg\Vert = \sqrt{ 2-2\cos(\bar\phi)} \tag{31} \label{31}$$


Let $A , B \in \mathbb{C}$, we have $$Z = A\cos(\theta) + B\sin(\theta) = (a+bj)\cos(\theta) + (c+dj)\sin(\theta) = (a\cos(\theta) + c\sin(\theta)) + j(b\cos(\theta) + d\sin(\theta)) = \sqrt{a^2 +c^2}\cos(\theta - x_1) + j\sqrt{b^2 +d^2}\cos(\theta - x_2)$$

Where $\tan(x_1) = \frac{c}{a}$ and $\tan(x_2) = \frac{d}{b}$. Note that here real and imaginary parts are independent of each other and it's enough to study $$f(a,b ,\theta) = \sqrt{a^2+b^2}\cos(\theta - x) = \sqrt{a^2+b^2}\mathrm{Re} (e^{-jx}e^{j\theta}) ,\ \ \ \ \tan(x) = \frac{b}{a}$$ So we can represent each of $\mathrm{Re}(Z)$ and $\mathrm{Im}(Z)$ by a phasor.

Tags:

Trigonometry