# Applying Hadamard gate to $\sqrt{3/4}|0\rangle + \sqrt{1/4}|1\rangle$

[I am just transferring this from Stack Overflow. It might need editing.]

————

I am trying to figure out quantum computing from YouTube videos, and pdf’s from universities, and odd bits here and there.

I have been confident that the two values in any q-bit must add to 1 — that is, their squares must.

Pertinent (or related) to Grover’s Algorithm, I have been trying to figure out the procedure for multiplying [i.e. increasing] the amplitude of the one q-bit, relative to the others.  (I mostly follow the trigonometry; it is the matrix side I am having trouble with… mostly because I am having trouble getting a handle on the syntax of the algebra.)

(I have been working from the following page.)

I think I understand the “reflection around |0〉” part — just flip the sign on the p[robability]|1〉 part.

(Incidentally, I take it that the pertinent q-bits still add to 1, through ignoring their signs?)

That leaves the “reflection around |ψ〉” part.  I have just found an account that is meaningful to me (rightly or wrongly!), on this page (straddling pp5 and 6).
https://theory.epfl.ch/courses/topicstcs/Lecture112016.pdf

If I understand correctly, it says that one  • applies a Hadamard Gate,  • reflects around |0〉 (as above), and  • applies a Hadamard Gate (again).  (I have not mentally conceptualised this yet.)

It all sounds fine.  The issue is that, when I try applying a Hadamard Gate to a biased superposition — {3/4,1/4} as opposed to {1/2,1/2} — the resulting probabilities (i.e. their squares) do not add to 1.

EDIT_01

1. My spreadsheet is as follows.

Columns A, B… D… F.
A ----------- B ----------…  D -----------…  F
= sqrt(0.5),  = sqrt(0.5)…  = sqrt(3/4)…  =(A1*D1)+(B1*D2)
= sqrt(0.5),  =-sqrt(0.5)…  = sqrt(1/4)…  =(A2*D1)+(B2*D2)

. Clmn(F)                      =SUM(F1,F2)

Respectively, for • all SQRT (as above), • SQRT(X/4), • SQRT(0.5) and • no SQRT…
I get 1.225…, 0.866…, 1.06… and 0.75.  (Of course, only one of those is “correct” — the first one, I believe — the point here is that this is not my/the error.)

Is my spreadsheet wrong, or is my rendition of matrix multiplication wrong, or is it in fact true that applying a Hadamard Gate to anything other than 0, 1, or 50/50 results in mayhem… or is it okay for a q-bit to have a total probability < 1… please?

• Hello, and welcome to the site! The post would probably be easier to read if you could use latex for equations. See e.g. quantumcomputing.meta.stackexchange.com/q/49/55 for the basics. Also, I can't quite tell what you are asking. You are trying to apply the Hadamard gate to $\sqrt{3/4}|0\rangle+\sqrt{1/4}|1\rangle$? If so, could you include the calculations you did to get the output probabilities? Otherwise it's hard to tell what went wrong
– glS
Sep 4 at 8:33
• Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
– Community Bot
Sep 4 at 8:38

It seems like you are trying to apply a Hadamadard gate to the state $$\frac{\sqrt{3}}{2}|0\rangle + \frac{1}{2}|1\rangle$$. This would go as follows:

\begin{align} H\left[\frac{\sqrt{3}}{2}|0\rangle + \frac{1}{2}|1\rangle\right] &= \frac{\sqrt{3}}{2}H|0\rangle + \frac{1}{2}H|1\rangle \\ &= \frac{\sqrt{3}}{2} \cdot \frac{1}{\sqrt{2}} \left( |0\rangle + |1\rangle \right) + \frac{1}{2} \cdot \frac{1}{\sqrt{2}} \left( |0\rangle - |1\rangle \right) \\ &= \frac{\sqrt{3}}{2\sqrt{2}}|0\rangle + \frac{\sqrt{3}}{2\sqrt{2}}|1\rangle + \frac{1}{2\sqrt{2}}|0\rangle - \frac{1}{2\sqrt{2}}|1\rangle \\ &= \frac{\sqrt{3}+1}{2\sqrt{2}}|0\rangle + \frac{\sqrt{3}-1}{2\sqrt{2}}|1\rangle \end{align}

Now, you can verify that the squared amplitudes add up to one:

\begin{align} \left|\frac{\sqrt{3}+1}{2\sqrt{2}}\right|^2+\left|\frac{\sqrt{3}-1}{2\sqrt{2}}\right|^2 &= \frac{3+2\sqrt{3}+1}{8}+\frac{3-2\sqrt{3}+1}{8} \\ &= \frac{3+2\sqrt{3}+1+3-2\sqrt{3}+1}{8} = \frac{8}{8} = 1 \end{align}

Using vector and matrices this may be a bit more straightforward. First, your initial state is $$\begin{bmatrix} \sqrt{3}/2 & 1/2 \end{bmatrix}^T$$. Applying the Hadamard matrix looks as follows:

$$\frac{1}{\sqrt{2}}\begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}\begin{bmatrix} \frac{\sqrt{3}}{2} \\ \frac{1}{2} \end{bmatrix} = \frac{1}{\sqrt{2}}\begin{bmatrix} \frac{\sqrt{3}+1}{2} \\ \frac{\sqrt{3}-1}{2} \end{bmatrix}$$

As you can see, this is the exact same state we got when using ket notation, therefore we already know that their amplitudes squared add up to 1.

• I am very grateful… but now I have to go and read, and figure out, and learn more. Sigh! Sep 4 at 17:15