Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Qubits, 2 complex numbers, forcing one to real

  1. Dec 29, 2014 #1
    Hi All,

    I'm working out a program to emulate a quantum computer (definitely in a nascent stage), and I'm struggling with a piece of the math. I looked at the math sections in these forums, but thought this might be more appropriate to post it. I'll try to conceptually outline the problem, and then post some of the math.

    When dealing with qubits, they are often conceptualized as two complex numbers...
    [tex]\alpha = A + Bi \\
    \beta = C + Di[/tex]
    However, it's customary to force B to be equal to zero (B=0), by changing the values of A, C, & D. Things are easy if we just set B to zero in the beginning. However, once the qubit (i.e., complex number pair) is pushed through a quantum gate, it is quite easy for B to have a non-zero value on the other side of the gate. A trivial example of this is the application of a NOT gate...

    [tex]\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} \times \begin{bmatrix} A + Bi \\ C + Di \end{bmatrix} = \begin{bmatrix} C + Di \\ A + Bi \end{bmatrix}[/tex]

    The Bi part might start out as zero. However, it starts out as part of Alpha, but winds up as part of Beta, so Alpha is no longer "Real" after the NOT gate is applied. (Note that I just swapped A & B with C & D to illustrate the NOT gate. However, in the following, it is assumed that A & B stay associated with Alpha, and that C & D stay associated with Beta.)

    Many gates do even more than this: Alpha may start out "Real", with either a "Real" or "Complex" Beta. However, after the application of the gate, both Alpha and Beta will be "Complex". That is precisely my problem. There is some transformation that allows us to "force" Alpha back to real (i.e., forcing B (post-gate) to zero), while still preserving all the other criteria of defining a qubit. This transformation is done by changing the values of A, C, & D. But let me outline the criteria that must be maintained:
    [tex]|\alpha|^2_{PreTransformation} = |\alpha|^2_{PostTransformation} \\
    |\beta|^2_{PreTransformation} = |\beta|^2_{PostTransformation} \\
    |\alpha|^2_{PreTransformation} + |\beta|^2_{PreTransformation} = 1 \\
    |\alpha|^2_{PostTransformation} + |\beta|^2_{PostTransformation} = 1 [/tex]

    This information might be enough to outline the problem (but I'm not sure it is). I just need the outline of an algorithm (transformation) to push Alpha back to "Real" after the application of any gate.

    However, there are other criteria that must be maintained. As those familiar with quantum computing know, all of this can be conceptualized as a Bloch sphere (with a corresponding Bloch vector).


    These additional criteria require the introduction of Theta and Phi (two angles in radians). And that's also where the problem rears it's head yet again. I can solve for Theta and Phi from Alpha and Beta so long as Alpha is "Real". Theta and Phi can be thought of as polar coordinates, with the limits of...
    [tex]0 \le \theta \le \pi \\
    0 \le \varphi < 2\pi[/tex]
    Theta is an angle of rotation about the Y axis. It can rotate the vector from straight up (0) to straight down (pi). Phi is an angle of rotation about the Z axis. Looking straight down from the top of the sphere, it rotates the vector around in the sphere. Theta and Phi provide unique positions on any/all points of the surface of the sphere (with the exceptions of when Theta = 0 or Theta = pi at which times, the value of Phi doesn't matter (and is just twisting rather than rotating the vector).

    Okay, here are the relationships between our Alpha and our Beta with our newly introduced Theta and Phi. But again, this is where my problem comes in. These relationships assume that Alpha is "Real" (and has no "Imaginary" part. Going back to the original definitions of Alpha and Beta (in terms of A, B, C, & D), we can say that...
    [tex]\theta = 2 \times ArcCos(A) \\
    ...and... \\
    \varphi = ArcCos(C / Sin(\theta / 2)),\ recognizing\ that\ \theta \ must\ be\ calculated\ first. \\
    ... or\ alternatively ... \\
    \varphi = ArcSin(D / Sin(\theta / 2)),\ still\ recognizing\ that\ \theta \ must\ be\ calculated\ first.[/tex]

    And, regardless of whether the ArcCos or ArcSin approach is taken to derive Phi, there is still one more consideration in calculating it. If D is less than zero, we must subtract it from 2pi. In other words, we must do something like the following after it's calculated...
    [tex]if\ D < 0\ then\ \varphi = 2\pi - \varphi [/tex]

    Also, it's important to notice that B didn't appear in the calculations of Theta and Phi, because B was assumed to be zero.

    For completeness, we can also solve for A, C, & D, given a Theta and Phi via...

    [tex]A = Cos(\theta / 2) \\
    C = Cos(\varphi) \times Sin(\theta / 2) \\
    D = Sin(\varphi) \times Sin(\theta / 2) [/tex]

    And again, the above assumes that B will be zero (making Alpha be "Real").

    So, to summarize the introduction of Theta and Phi (which define a specific Bloch vector), they can not change during the transformations of A, C, & D, making B=0.

    That's about it. So, in an attempt to summarize my problem, I need an algorithm that pushes Alpha back to a "Real" number (i.e. B=0) after it has been made "Complex" from pushing the qubit through a gate.

    Even a reference to some webpage that discusses this would be much appreciated. I've looked through several reference that I have, but haven't found the answer. I'm suspecting that it's rather simple (once it's all said and done), but I'm just not seeing it.

    Regards (and thanks in advance),
    Last edited: Dec 29, 2014
  2. jcsd
  3. Dec 29, 2014 #2
    Actually, just staring at it, I can provide a bit more information, and actually solve part (but not all) of the problem. If Alpha stays real, then A will vary from ZERO to ONE (always being positive, never negative). Therefore, using the above equalities and criteria, we can solve for a transformed A & B...

    [tex]A_{PostTransformation} = \sqrt{A_{PreTransformation}^2 + B_{PreTransformation}^2} \\
    B_{PostTransformation} = 0 [/tex]

    This transforms A and B, and also makes Alpha "Real". However, I'm still struggling with a post-transformation C and D.

    Since I can get a transformed A, I can even solve for Theta, but I still can't solve for Phi without post-transformation C and D. If I could, I could just re-solve for C and D, using Phi. :(
  4. Dec 29, 2014 #3
    Shucks, I'll even provide an example of the problem. Let's say we start out with a qubit in the state...
    [tex]\alpha = .959 + 0i \\
    \beta = .179 + .221i[/tex]
    We see that we start out with a "Real" Alpha. Now, let's shove it through a NOT gate. After that, the qubit looks like (set #1)...
    [tex]\alpha = .179 + .221i \\
    \beta = .959 + 0i[/tex]
    However, in the spirit of keeping Alpha "Real", it should look like (set #2)...
    [tex]\alpha = .284 + 0i \\
    \beta = .603 - 745i[/tex]
    It can be verified that...
    [tex] .284^2 = .179^2 + .221^2 [/tex]
    ... and that ...
    [tex] .959^2 = .603^2 + .745^2 [/tex]
    So, it's clear that my equalities are holding.
    I also have software that verifies that the Bloch vector isn't changed from set #1 to set #2. However, I don't have the algorithms to transition from set #1 to set #2.
  5. Dec 30, 2014 #4
    Pffff... You guys are slacking. I figured it out on my own.

    When dealing with complex numbers like...
    ... that represent a qubit, we get an Anew as outlined in my post #2.

    Then, we get the complex conjugate of Alpha.
    Then, we multiply both Alpha and Beta by this Alphaconjugate, creating two temporary complex variables (C1 and C2). However, the first one is real, because a complex number multiplied by its conjugate is always real.

    Then, we create a real number ratio by going...
    [tex]ratio = A_{new} \times C_1[/tex]
    Both Anew and C1 are real, so ratio will also be real.

    Then, we multiply C2 by this ratio.

    Now, Anew is our new (transformed) Alpha (with no imaginary part), and C2 (multiplied by ratio) is our new (transformed) Beta.

    And all of our equalities still hold, and the Bloch vector (i.e. Theta and Phi) is unchanged.

    You guys should stop "talking" about the meaning of math, and start doing some. And just an FYI for another thread I saw here, Roger Penrose has the best description I've ever seen discussing the "reality" of math. Here's a random link to how he outlines it (but I'm sure you can do better with Google). http://www.mountainlake.com/mlp/travel/3worldsx.jpg
  6. Dec 30, 2014 #5


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    You can't expect to get super fast answers every day, every time of the day. People have jobs, need sleep, and so on. It also doesn't help to bump your own thread repeatedly the same day, as it makes it look like someone is already helping you. It also makes people who open the thread think that they're going to have to read a lot of text just to understand what you're asking, and might discourage them from finding out what you need help with.

    I would write a qbit as a complex 2×1 matrix ##\begin{pmatrix}a\\ b\end{pmatrix}##. If you multiply this by any complex number c, you get another 2×1 matrix ##c\begin{pmatrix}a\\ b\end{pmatrix}=\begin{pmatrix}ca\\ cb\end{pmatrix}## that represents the same state. So if you want the first component to be real, all you have to do is (as you seem to have already figured out) to choose ##c=a^*##.

    However, it's also conventional to use matrices of norm 1. The norm ##\|s\|## of a 2×1 matrix ##s## is defined by ##\|s\|=\sqrt{s^*s}##, where ##{}^*## denotes the conjugate transpose, so if ##\begin{pmatrix}a\\ b\end{pmatrix}## has norm 1, we have
    $$1=\left\|\begin{pmatrix}a\\ b\end{pmatrix}\right\|^2 =\begin{pmatrix}a\\ b\end{pmatrix}^*\begin{pmatrix}a\\ b\end{pmatrix} =\begin{pmatrix}a^* & b^*\end{pmatrix}\begin{pmatrix}a\\ b\end{pmatrix}=a^*a+b^*b=|a|^2+|b|^2.$$ If we want ##\begin{pmatrix}ca\\ cb\end{pmatrix}## to be normalized (i.e. have norm 1) as well, we can't just choose ##c=a^*##. But we can choose ##c=Na^*##, where ##N## is the unique positive real number that ensures that ##\begin{pmatrix}ca\\ cb\end{pmatrix}## is normalized. This is how I would find that number:
    &1=\left\|\begin{pmatrix}Na^*a\\ Na^*b\end{pmatrix}\right\|^2 = |N|^2\left\|\begin{pmatrix}a^*a\\ a^*b\end{pmatrix}\right\|^2 =|N|^2\left(|a^*a|^2+|a^*b|^2\right) =|N|^2\left(|a|^4+|a|^2|b|^2\right) \\ &=|N|^2|a|^2(|a|^2+|b|^2)=|N|^2|a|^2.
    (Note that in the last step, I used the assumption that the original matrix was normalized). This implies that the ##N## we seek is ##1/|a|##. So the appropriate choice for ##c## is ##a^*/|a|##. (Edit: I fixed a mistake at the end. I had written ##a^*/a## instead of ##a^*/|a|##).
    Last edited: Dec 30, 2014
  7. Dec 30, 2014 #6
    Hey Fredrik,

    Thank you VERY much for the reply. I haven't thought through (and tested) all of it, but it seems to conceptually be a better answer than the one I came up with (although I think they both get the job done). And yeah, you're right about the length of my original post, but it just wasn't an easy problem to outline (at least, not for me).

    Thanks Again,
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Qubits, 2 complex numbers, forcing one to real