From 8750ea2766bbdff459a36d07a24ee23c8ef4991f Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Thu, 5 Jun 2025 17:13:04 +0300 Subject: [PATCH] feat: add qubit transformations --- layout.typ | 2 + main.typ | 131 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+) diff --git a/layout.typ b/layout.typ index 0ea8d26..c0f8a3f 100644 --- a/layout.typ +++ b/layout.typ @@ -48,6 +48,8 @@ // Formatting for regular text set par(justify: true, leading: 1em) show heading: set block(spacing: 0.7em) + show heading: set text(size: 14pt) + show heading: set par(justify: false) set terms(separator: [ -- ]) diff --git a/main.typ b/main.typ index 0a892f7..a1839aa 100644 --- a/main.typ +++ b/main.typ @@ -9,6 +9,8 @@ "Kristofers Solo", )) +#let distance = $space.quad space.quad$ + = Bre-Ket Notation == Ket $ket(psi)$ Represents a column vector for a quantum state. @@ -96,3 +98,132 @@ $ P(1) & =abs((1-i)/sqrt(7))^2=(1^2+(-1)^2)/7=2/7 $ #tip[ Sum must be $1$. ] + += Single Qubit Unitary Transformations +Quantum gates are unitary matrices $U$. +$ U U^dagger=U^dagger U=I $ +=== Properties + +Linearity +$(U(alpha ket(psi_1)+beta ket(psi_2))=alpha U ket(psi_1)+beta U ket(psi_2))$ +and preserves vector length. +=== Matix form +If $U ket(0)=a ket(0)+b ket(1))$ and $U ket(1)=c ket(0) + d ket(1)$, then +$ U=mat(a, c; b, d) $ + +Columns (and rows) must be orthonormal vectors: \ +$arrow(v_1^*) dot arrow(v_2)=0$ and $abs(arrow(v_1))^2=1$. + +== Pauli Gates +=== I (Identity) +$ + I=mat(1, 0; 0, 1) distance + cases( + I ket(0)=ket(0), + I ket(1)=ket(1) + ) +$ + +=== X (NOT) +Bit flip +$ + X=mat(0, 1; 1, 0) distance + cases( + X ket(0)=ket(1), + X ket(1)=ket(0) + ) +$ + +=== Y Gate +$ + Y=mat(0, -i; i, 0) distance + cases( + Y ket(0)=-i ket(1), + Y ket(1)=i ket(0) + ) +$ + +=== Z Gate +Phase flip +$ + Z=mat(1, 0; 0, -1) distance + cases( + Z ket(0) = ket(0), + Z ket(1) = -ket(1), + ) +$ + +== Hadamard Gate ($H$) +Creates superpositions +$ + H=1/sqrt(2) mat(1, 1; 1, -1) distance + cases( + H ket(0)=1/sqrt(2) ket(0) + 1/sqrt(2) ket(1), + H ket(-1)=1/sqrt(2) ket(0) - 1/sqrt(2) ket(1) + ) \ + cases( + H ket(0)=ket(+), + H ket(1)=ket(-) + ) distance + H H=H^2=I +$ + +== Phase Gates +=== $S$ Gate $(sqrt(Z))$ +$ S= mat(1, 0; 0, i) distance S^2=Z $ + +=== $T$ Gate $(pi/8))$ +$ T= mat(1, 0; 0, e^(i pi/4)) distance T^2=S $ + +== Rotation Gates ($R_n (theta)$) +$ + R_x (theta)= + e^((-i theta X)/2)= + mat( + cos theta/2, -i sin theta/2; + -i sin theta/2, cos theta/2 + ) +$ + +$ + R_y (theta)= + e^((-i theta Y)/2)= + mat( + cos theta/2, -sin theta/2; + sin theta/2, cos theta/2 + ) +$ + +$ + R_z (theta)= + e^((-i theta Z)/2)= + mat( + e^((-i theta)/2), 0 + 0, e^((i theta)/2) + ) +$ + +#tip[ + $R_alpha: cases( + R_alpha ket(0):cos alpha ket(0)+sin alpha ket(1), + R_alpha ket(1):-sin alpha ket(0)+cos alpha ket(1), + )$. This is $R_y(-2 alpha)$.] + +== Game Compositions +Applied right to left. $U V ket(psi)=U(V ket(psi))$. +- $H Z H=X$ +- $H X H=Z$ + +== Inverse Tranformation +$ U^(-1)=U^dagger $ + +== Non-Unitary Operations +(Not physically realizable as closed system evolution) + +=== Qubit Deletion +$ + cases( + U ket(0) = ket(0), + U ket(1) = ket(0) + ) +$