# Difficult system of equations with complex numbers

I'm attempting to code an AC power circuit simulator (for fun, imagine that) and I'm running into a mathematical stump. I've simplified the problem into these equations: $$a=bx+c$$ $$d=ex+f$$ $$P=|a||d|\cos(\theta_a-\theta_d)=a_R d_R+a_I d_I(=a\cdot d)$$ Where $$a, b, c, d, e, f,$$ and $$x$$ are all complex numbers, $$P$$ is a real number, and we know the values of $$|a|, b, c, e, f,$$ and $$P$$.

I know you can't really do a dot product between complex numbers but that's kind of how I'm thinking of this last equation (most of these complex numbers are actually phasors, or vector-wannabes anyways).

I need to find a way to express $$x$$ in terms of the known values. Is this even possible without knowing $$\theta_a$$ or $$d$$?

I don't seem to be getting anywhere by breaking down the first two equations into Real and Imaginary parts - it seems to be making more unknown values, which just makes this messier. But if I commit to polar form I'm finding it hard to deal with the cosine. Thank you for taking a look.

• The dot product between complex numbers is defined : What is the dot product of complex vectors? Commented Jul 28, 2022 at 3:34
• @Conan That entry refers to the dot product of complex vectors, a vector with complex coordinates, while here we're dealing with complex scalars. The dot product of a complex vector would have us multiply a complex scalar in one vector by the conjugate of the similarly-indexed complex scalar in the other vector - the way I'm "using" a dot product here is different. Commented Jul 28, 2022 at 11:00
• Welcome! That's a great first question for someone new to this site. Commented Jul 29, 2022 at 2:25
• @TobyMak Thank you! Commented Jul 30, 2022 at 3:15

Let $$a = |a|e^{i\theta}$$ (your $$\theta_a$$, but I'm dropping the subscript as a needless pain). The first equation tells us that $$x = \frac{|a|e^{i\theta} - c}b$$ so if we can figure out $$\theta$$, then we can figure out $$x$$.
The second equation tells us that $$d = \frac{e|a|}be^{i\theta} +\left(f-\frac cb\right)$$
Now, $$a\cdot d = \Re(\bar ad)$$ ($$\Re(z)$$ denotes the real part of $$z$$). So the third equation tells us that $$\Re\left[|a|e^{-i\theta}\left(\frac{e|a|}be^{i\theta} + f-\frac cb\right)\right] = P\\\Re\left(\frac{e|a|}b\right) + \Re\left[\left(f-\frac cb\right)e^{-i\theta}\right] = \frac P{|a|}$$
Letting $$Q = \frac P{|a|} - \Re\left(\frac{e|a|}b\right)$$ and $$re^{i\phi} = f-\frac cb$$, we get $$\Re\left(re^{i(\phi - \theta)}\right) = Q$$ $$\cos(\phi - \theta) = \frac Qr$$ As $$Q, r, \phi$$ are all defined by known quantities, you can solve the equation for $$\theta$$ (in general, there will be two non-equivalent solutions), and obtain $$x$$ using the equation for it above.