- #1
- 42
- 9
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),
Elroy
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),
Elroy
Last edited: