import numpy as np

z_plus_bra = np.array([[1,0]])
z_minus_bra = np.array([[0,1]])
z_plus_ket = z_plus_bra.T
z_minus_ket = z_minus_bra.T
x_plus_bra = 1/np.sqrt(2)*np.array([[1,1]])
x_minus_bra = 1/np.sqrt(2)*np.array([[1,-1]])
x_plus_ket = x_plus_bra.T
x_minus_ket = x_minus_bra.T
y_plus_bra = 1/np.sqrt(2)*np.array([[1, 1j]])
y_minus_bra = 1/np.sqrt(2)*np.array([[1, -1j]])
y_plus_ket = np.conj(y_plus_bra.T)
y_minus_ket = np.conj(y_minus_bra.T)

```
a) Determine ⟨S_x⟩ for this state:
Take the probability amplitude A_up and multiply by its complex conjugate to find the probability A_up_prob
A_up_prob = [[0.5+0.j]]
Repeat with the spin-down orientation. You should receive a value such that A_up_prob + A_down_prob = 1
A_down_prob = [[0.5+0.j]]
Now apply these values to the equation <S_x> = hbar/2 * (A_up_prob - A_down_prob)
<S_x> = [[0.+0.j]] hbar/2 = 0
b) Determine ⟨S_y⟩ for this state.
Repeat the above process with the spin states of the y and z axis
A_up_prob = [[0.0669873+0.j]]
A_down_prob = [[0.9330127+0.j]]
<S_y> = [[-0.8660254+0.j]] hbar/2 = -sqrt(3)/4 hbar
c) Determine ⟨S_z⟩ for this state.
A_up_prob = [[0.25+0.j]]
A_down_prob = [[0.75+0.j]]
<S_z> = [[-0.5+0.j]] hbar/2 = -1/2 hbar
d) Interpret your results. What can you conclude about the state without further calculations (i.e. ignoring the results you got in the written homework)
These values are accurate and reflect proper use of multiplication with bra and ket notation.
e) Do these results match with what you got for the written homework?
No. I beleive that I made errors on my math and received incorrect values for <S_x>
```

```
a) Calculate ⟨ψ_11∣ψ_10⟩
psi_11_bra@psi_11_ket = [[1.+0.j]]
Probability amplitude is [[0.+1.j]]
b) Then calculate |⟨ψ_11∣ψ_10⟩∣^2
∣⟨ψ_11∣ψ_10⟩∣^2 = [[1.+0.j]]
Probability is [[1.+0.j]]
c) Interpret your results.
This probability yields 1, which means that this orientation will yield 100% particle transmission
```

```
a) Find a vector perpendicular to ∣ψ_10⟩, show that it is in fact perpendicular to ∣ψ_10⟩
∣ψ_10⟩ = (1/2)*|+z⟩ + (i*sqrt(3)/2)*|-z⟩
taking the vector perpendicular to ∣ψ_10⟩, we obtain:
∣ψ_10⟩_perp = 1/(1/2)*z_plus_ket - 1j/(np.sqrt(3)/2)*z_minus_ket
Normalizing this vector, we obtain norm_perp:
norm_perp = [[5.33333333+0.j]]
Given that the perpendicular vector is perpendicular to ∣ψ_10⟩, their product should be 0
amp = psi_10_perp_bra@psi_10_ket
amp = [[0.+0.j]]
b) Calculate the inner product of this new vector with |ψ_11⟩
amp2 = psi_10_perp_bra@psi_11_ket
amp2 = [[0.+0.j]]
c) Interpret this result in part b. What can you tell about the state described by the new vector compared to the state described by |ψ_11⟩
Given that these vectors are exptremely similar, so we can expect their proabilities to be similar
Based on these results, our prediction is accurate.
d) Take the inner product of the perpendicular vector with itself. For a normalized vector this should be equal to 1 but here it isn't.
Normalize the vector so the inner product with itself is equal to 1.
The normalization of the perpendicular vector yields:
Normal = [[5.33333333+0.j]]
We wish to create a set of values such that ⟨ψ∣ψ⟩ = 1 = a^2 + b^2, where a and b are constants. Currently,
a = [[2.+0.j]]
b = [[0.+1.15470054j]]
Which does not satisfy the above.
```