```python
from sympy import *
init_printing(use_unicode=True, use_latex=True)
```

# Unitary rotation operators around the Bloch Sphere

## Introduction

In this document we are going to automatically derive the unitary operators representing the rotations arount the Bloch Sphere. This will be done under assumption Hamiltonian operator is time-independent. We will do it for the three Pauli operators $\sigma^x$, $\sigma^y$ and $\sigma^z$.

## Deriving the unitary operator

Hamiltonian operator $H$ is a representation of acting on a quantum state $\left| \psi(t) \right>$ in a Schrödinger picture, where operators are constant and quantum states depend on time. On the other hand, in Heisenberg picture, a unitary operator $U(t)$ is an semantically equivalent representation in which the the operator is time-dependent and quantum state $\left| \psi \right>$ is static.

Let us define a function which symbolically derives the $U(t)$ from $H$ using

\begin{equation}
U(t) = e^{-\frac{i t}{2}H}
\end{equation}

under assumption that $\frac{d}{dt}H=0$ or simply, $H$ does not depend on time.


```python
def timeIndependentHtoU(H, t) :
    rows, columns = H.shape
    U = zeros(rows, columns)
    eigenvects = H.eigenvects()
    for eigenvalue, multiplicity, eigenvectors in eigenvects :
        l = eigenvalue
        m = multiplicity
        for eigenvector in eigenvectors :
            normalized_eigenvector = eigenvector.normalized()
            entry = exp(-I*t*l*m/2)*normalized_eigenvector*conjugate(normalized_eigenvector.T)
            U += entry
    return U
```

## Defining the Pauli operators

Operators matrices are defined as

\begin{align}
\sigma^x = \begin{bmatrix}0 & 1\\1 & 0\end{bmatrix},
\sigma^y = \begin{bmatrix}0 & -i\\i & 0\end{bmatrix},
\sigma^z = \begin{bmatrix}1 & 0\\0 & -1\end{bmatrix}
\end{align}

Let us define them as `SymPy` matrices and derive the rotation operators $R_x(t)$, $R_y(t)$ and $R_z(t)$ correponsing to $\sigma^x$, $\sigma^y$ and $\sigma^z$ (respectively).


```python
t = Symbol('t')

s_x = Matrix([[0, 1], [1, 0]])
s_y = Matrix([[0, -I], [I, 0]])
s_z = Matrix([[1, 0], [0, -1]])

r_x = timeIndependentHtoU(s_x, t)
r_y = timeIndependentHtoU(s_y, t)
r_z = timeIndependentHtoU(s_z, t)

display(simplify(r_x), simplify(r_y), simplify(r_z))
```

## Discuss results

Expected solution is

\begin{align}
R_x(t) = \begin{bmatrix}cos(\frac{t}{2}) & -i sin(\frac{t}{2})\\-i sin(\frac{t}{2}) & cos(\frac{t}{2})\end{bmatrix},
R_y(t) = \begin{bmatrix}cos(\frac{t}{2}) & - sin(\frac{t}{2})\\sin(\frac{t}{2}) & cos(\frac{t}{2})\end{bmatrix},
R_z(t) = \begin{bmatrix}e^{-\frac{it}{2}} & 0\\0 & e^{\frac{it}{2}}\end{bmatrix}
\end{align}

which matches the result we symbolically derived using `SymPy`.

05ec1ebcfdfbf1241c46ce16a947104acba8bd5b
ipynb
Jupyter Notebook
bloch-sphere-rotations.ipynb
marekyggdrasil/notebooks
22644eb62b7833fb4ef7fd751b3fc6f01ceebe09
MIT
bloch-sphere-rotations.ipynb
marekyggdrasil/notebooks
22644eb62b7833fb4ef7fd751b3fc6f01ceebe09
MIT
bloch-sphere-rotations.ipynb
marekyggdrasil/notebooks
22644eb62b7833fb4ef7fd751b3fc6f01ceebe09
MIT
Qwen/Qwen-72B
1. YES
2. YES