# What is $H\left| \psi \right>$ with $\left| \psi \right> = \alpha\left| 0 \right> + \beta\left| 1 \right>$?

I'm currently going through Introduction to Classical and Quantum Computing, by Thomas Wong, and I'm struggling with exercise 2.29 (page 107):

Exercise 2.29. Say $$\left| \psi \right> = \alpha\left| 0 \right> + \beta\left| 1 \right>$$ is a normalized quantum state, i.e., $$|\alpha|^2 + |\beta|^2 = 1$$.

(a) Calculate $$H\left| \psi \right>$$.

Given the two following transformations the Hadamard gate does:

\begin{align} H\left| 0 \right> &= \frac{1}{\sqrt{2}}(\left| 0 \right> + \left| 1 \right>)\\ H\left| 1 \right> &= \frac{1}{\sqrt{2}}(\left| 0 \right> - \left| 1 \right>) \end{align}

I did the following:

\begin{align} H\left| \psi \right> &= \alpha H\left| 0 \right> + \beta H\left| 1 \right>\\ &= \frac{\alpha}{\sqrt{2}}(\left| 0 \right> + \left| 1 \right>) + \frac{\beta}{\sqrt{2}}(\left| 0 \right> - \left| 1 \right>)\\ &= \frac{\alpha}{\sqrt{2}}\left| 0 \right> + \frac{\alpha}{\sqrt{2}}\left| 1 \right> + \frac{\beta}{\sqrt{2}}\left| 0 \right> - \frac{\beta}{\sqrt{2}}\left| 1 \right>\\ &= \frac{\alpha + \beta}{\sqrt{2}}\left| 0 \right> + \frac{\alpha - \beta}{\sqrt{2}}\left| 1 \right> \end{align}

Though, the answer given at the back of the book (page 360) is (notice the $$+$$ sign): \begin{align} H\left| \psi \right> &= \frac{\alpha + \beta}{\sqrt{2}}\left| 0 \right> + \frac{\alpha + \beta}{\sqrt{2}}\left| 1 \right> \end{align}

Why is that? This is a simple exercise, yet I can't seem to find what I'm doing wrong.

• Your result is correct. The answer you quote from the book is wrong and probably a typo. You can quickly check by plugging in $\alpha=0,\beta=1$, in which case that answer results in $H|1\rangle = |+\rangle$. More generally I don't think that is even a valid quantum state. Mar 3, 2023 at 21:37
• @forky40 oh, well that explains it... Mar 3, 2023 at 21:43
• @forky40 I think you still should write this as an answer, should anyone stumble upon the same problem! Mar 3, 2023 at 21:45
• Just reached out to the author of the textbook to fix the mistake, hopefully they see my email. Mar 3, 2023 at 21:49

Moreover, if you write down your state as $$| \psi \rangle = \alpha | 0 \rangle + \beta | 1 \rangle = \begin{bmatrix} \alpha \\ \beta \end{bmatrix}$$ and the Hadamard gate as $$H = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 1\\ 1 & -1 \end{bmatrix}$$, then computing the result is straightforward: $$H | \psi \rangle = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 1\\ 1 & -1 \end{bmatrix} \begin{bmatrix} \alpha \\ \beta \end{bmatrix} = \frac{1}{\sqrt{2}} \begin{bmatrix} \alpha + \beta \\ \alpha - \beta \end{bmatrix} = \frac{\alpha + \beta}{\sqrt{2}} | 0 \rangle + \frac{\alpha - \beta}{\sqrt{2}} | 1 \rangle$$
Your result is correct. The answer you quote from the book is wrong and probably a typo. You can quickly check by plugging in α=0,β=1, in which case that answer results in $$H|1\rangle = |+\rangle$$. More generally that is not a valid quantum state - for example, set $$\alpha=\beta=1/\sqrt{2}$$ and the result will be $$\sqrt{2}|+\rangle$$.