Posted on ,3 min read

Melchior and I are doing a course offered by KAIST on coursera.org. This web notes has solutions to some problems from the course. We’re pretty new to this so the solutions might contain errors. If you do find an error in the solution please write to [email protected].

(2) Suppose that a qubit is prepared in state $∣0⟩$. Then, a measurement is performed in the basis $∣±⟩=2 (∣0⟩±∣1⟩) $. What is the probability of the outcome +?

(A) The probability of the outcome + can be calculated with the rule $P(+)=⟨ψ∣M_{+}∣ψ⟩$, also known as the Born’s rule, where for this particular question, we can see that $∣ψ⟩=∣0⟩$, $⟨ψ∣=⟨0∣$, $∣+⟩=2 1 ∣0⟩+2 1 ∣1⟩$, and $M_{+}=∣+⟩⟨+∣$.

$P(+) =⟨ψ∣M_{+}∣ψ⟩=⟨0∣⋅∣+⟩⋅⟨+∣⋅∣0⟩=[1 0 ]⋅[1/2 1/2 ]⋅[1/2 1/2 ]⋅[10 ]=21 $

(3) Suppose that a qubit is prepared in a state $∣+⟩=(∣0⟩+∣1⟩)/2 $. A measurement is performed in the computation basis ${∣0⟩,∣1⟩}$. Find the expectation value of an observable $Z=∣0⟩⟨0∣−∣1⟩⟨1∣$.

(A) We know that the expectation value of $Z$ with respect to $∣+⟩$ can be calculated as $⟨Z⟩_{∣+⟩}=⟨+∣Z∣+⟩$. Here simplifying and computing $Z=∣0⟩.⟨0∣−∣1⟩.⟨1∣$ would simply make it equal to $0.$ Therefore the answer would be $0.$

(5) For a state $∣+⟩=(∣0⟩+∣1⟩)/2 $, suppose that a phase operation $P(ϕ)=∣0⟩⟨0∣+e_{iϕ}∣1⟩⟨1∣$ is applied. When a measurement is performed in the basis $∣±⟩=(∣0⟩±∣1⟩)/2 $, find the angle $ϕ$ such that the probability of obtaining out $+$ is zero.

(A) Wow, this question is really good. The idea is that we’ll need to first apply $P(ϕ)$ to $∣+⟩$, and get a new state, say, $∣ψ⟩$, and then solve for the equation $⟨ψ∣M_{+}∣ψ⟩=0$, or $⟨ψ∣M_{−}∣ψ⟩=1$.

$∣ψ⟩=P(ϕ)⋅∣+⟩⟨ψ∣M_{−}∣ψ⟩⇒e_{iϕ}⇒ϕ =2 1 (∣0⟩+e_{iϕ}⋅∣1⟩)=[2 1 2 e_{iϕ} ]⋅[1/2 −1/2 ]⋅[2 1 −2 1 ]⋅[1/2 2 e_{iϕ} ]=1=−1=π $

In Week 2, I use a bit of the wonderful `sympy`

library for some matrix algebra calculations instead of hand-calculating things.

(2) For a Hadamard gate H and a Pauli matrix Z, compute ZHZ.

```
>>> import sympy
>>> from sympy.matrices import Matrix
>>> x = 1/sympy.sqrt(2)
>>> H = Matrix([[x, x], [x, - x]])
>>> Z = Z = Matrix([[1, 0], [0, -1]])
>>> Z * H * Z
Matrix([
[ sqrt(2)/2, -sqrt(2)/2],
[-sqrt(2)/2, -sqrt(2)/2]])
```

As we see, the answer is $−H$.

(3) For Pauli matrices X, Y, Z, compute $tr[X+Y+Z]$.

```
>>> from sympy import I, Trace
>>> X = Matrix([[0, 1], [1, 0]])
>>> Y = Matrix([[0, -I], [I, 0]])
>>> Trace(X+Y+Z).simplify()
0
```

The answer is $0$.

We ended up getting a certificate (in my name below because we did it from my Coursera account):

In addition, we’ve come to learn that Scott is doing the course too, but unfortunately we’re not really aware of his progress at the moment.

Readings: