# How do you compute ab+i in terms of a and b

Given that $$a+bi=p$$ and $$a^2-b^2=q$$, how can I compute $$ab+i$$?

Note

$$i=\sqrt{-1}$$ is the complex number

$$a$$ and $$b$$ can be any integer

• In terms of $a$ and $b$, $ab+i$ is $ab+i$... – Arnaud Mortier Mar 2 at 13:48
• Hint: what is $\frac{p^2-q}{2i}$? – Conrad Mar 2 at 13:50
• I assume that you mean to compute it in terms of $p$ and $q$ not in terms of $a$ and $b$. – quid Mar 2 at 16:28

$$p^2=a^2+2iab-b^2=q+2iab$$ Therefore $$ab+i=\frac{p^2-q}{2i} +i$$
Squaring the firtst equation we get $$a^2-b^2+2abi=p^2$$ so we get $$ab=-\left(\frac{p^2-q^2}{2}\right)i$$ Can you finish? We get $$ab+i=\left(-\left(\frac{p^2-q^2}{2}\right)+1\right)i$$
Square both sides, so $$(a)^2+(bi)^2+2abi=p^2$$. Since $$i^2=-1$$, $$a^2-b^2+2abi=p^2$$.
Substituting $$q=a^2-b^2$$, $$q+2abi=p^2$$, and $$ab=\frac{p^2-q}{2i}$$, so $$ab+i=\frac{p^2-1}{2i}+i=\frac{p^2-q}{2i}+\frac{2i^2}{2i}=\frac{p^2-q-2}{2i}$$