diff --git a/DM4.typ b/DM4.typ index 6049db4..9ed9c35 100644 --- a/DM4.typ +++ b/DM4.typ @@ -1,31 +1,16 @@ +#import "qcs.typ": * #set page( paper: "a4", header: align(center)[ QCS - DM4 - Augustin LUCAS ], ) -#import "@preview/showybox:2.0.1": showybox -#import "@preview/physica:0.9.3": bra, ket -#showybox( - frame: ( - border-color: blue.darken(50%), - title-color: blue.lighten(60%), - body-color: blue.lighten(80%) - ), - title-style: ( - color: black, - weight: "regular", - align: center - ), - shadow: ( - offset: 3pt, - ), - title: "Assignment Q1", +#question("Assignment Q1", ([ + Let $U=mat(u_(00),u_(01);u_(10),u_(11))$. Write a matrix representation of $U[1]$ and $U[2]$ for $n=2$. + For $n=3$, write a matrix representation of CNOT$[3,1]$. - ]), + ]) ) + $U[1] &= U times.circle I @@ -64,21 +49,7 @@ )$ -#showybox( - frame: ( - border-color: blue.darken(50%), - title-color: blue.lighten(60%), - body-color: blue.lighten(80%) - ), - title-style: ( - color: black, - weight: "regular", - align: center - ), - shadow: ( - offset: 3pt, - ), - title: "Assignment Q2", +#question("Assignment Q2", ([ Let $A=1/sqrt(2) mat(-i,-1;1,i)$ and $B=mat(0,1;-1,0)$. Which 2-qubit gate can you apply on the first qubits at the end of the circuit diff --git a/DM5.typ b/DM5.typ new file mode 100644 index 0000000..9f100bf --- /dev/null +++ b/DM5.typ @@ -0,0 +1,105 @@ +#import "qcs.typ": * +#set page( + paper: "a4", + header: align(center)[ + QCS - DM5 : Phase estimation - Augustin LUCAS + ], +) + + +#question("Assignment Q1", [ + Show that after applying the phase estimation circuit described in class, + we obtain (in the first register) the state + + $ 1/2^m sum_(j=0)^(2^m-1)(sum_(k=0)^(2^m-1)e^(2 pi i k (theta-j 2^(-m)))) $ +]) + +The phase estimation circuit described in class is: + +#{ + import "@preview/quill:0.4.0": * + + quantum-circuit( + lstick($ket(0)$), $H$, slice(label: $ket(Phi_0)$), ctrl(3, show-dot: false), + slice(label: $ket(Phi_1)$), mqgate($Q F T_(2^m)^dagger$, n:3), slice(label: $ket(Phi_2)$, n:3), [\ ], + setwire(0), midstick($dots.v$), midstick($dots.v$), 2, midstick($dots.v$), [\ ], + lstick($ket(0)$), $H$, 1, [\ ], + lstick($ket(psi)$), 1, $U$, 3, rstick($$) + ) +} + +First, $ ket(Phi_0) = ket(+)^(times.circle m) times.circle ket(phi) $ +Then, $ ket(Phi_1) &= gamma_m (U) ket(Phi_0) \ + &= gamma_m (U) (ket(+)^(times.circle m) times.circle ket(phi)) \ + &= gamma_m (U) (((ket(0)+ket(1))/sqrt(2))^(times.circle m) times.circle ket(phi)) \ + &= gamma_m (U) 1/sqrt(2^m) sum_(k=0)^(2^m-1) ket(k) times.circle ket(phi) \ + &= 1/sqrt(2^m) sum_(k=0)^(2^m-1) gamma_m (U) (ket(k) times.circle ket(phi)) \ + &= 1/sqrt(2^m) sum_(k=0)^(2^m-1) ket(k) times.circle U^k ket(phi) \ + &= 1/sqrt(2^m) sum_(k=0)^(2^m-1) e^(2 pi i theta k) ket(k) times.circle ket(phi) $ + + + +With $Q F T_(2^m)^dagger = 1/sqrt(2^m) mat( + 1, 1, ..., 1; + 1, omega, ..., omega^(2^m-1); + dots.v, dots.v, dots.down, dots.v; + 1, omega^(2^m-1), ..., (omega^(2^m-1))^(2^m-1); +)$, where $omega = e^((2 i pi)/2^m)$ + +we have $ ket(Phi_2) &= Q F T_(2^m)^dagger ket(Phi_1) \ + &= 1/sqrt(2^m) sum_(k=0)^(2^m-1) e^(2 pi i theta k) Q F T_(2^m)^dagger ket(k) \ + &= 1/sqrt(2^m) sum_(k=0)^(2^m-1) e^(2 pi i theta k ) + (1/sqrt(2^m) sum_(j=0)^(2^m-1) e^(-2 pi i k j 2^(-m)) ket(j)) \ + &= 1/2^m sum_(j=0)^(2^m-1) + (sum_(k=0)^(2^m-1) e^(2 pi i k (theta-2^(-m)j))) ket(j) $ + + +#question("Assignment Q2", [ + We now measure this state in the standard basis. + Compute the probability $p_j$ of obtaining outcome $j$. +]) + +$ p_j &= abs(braket(Phi_2, j))^2 \ + &= abs(braket(1/2^m sum_(l=0)^(2^m-1) + (sum_(k=0)^(2^m-1) e^(2 pi i k (theta-2^(-m)l))) l, j))^2 \ + &= abs( 1/2^m sum_(l=0)^(2^m-1) sum_(k=0)^(2^m-1) + e^(2 pi i k (theta-2^(-m)l)) braket(l, j) )^2 \ + &= abs( 1/2^m sum_(k=0)^(2^m-1) + e^(2 pi i k (theta-2^(-m)j)) braket(j, j) )^2 \ + &= abs( 1/2^m sum_(k=0)^(2^m-1) + (e^(2 pi i (theta-2^(-m)j)))^k)^2 \ + &= 1/2^(2m) abs( + ( 1-e^(2 pi i (2^m theta - j)) ) + /(1-e^(2 pi i (theta - 2^(-m)j))) + )^2 $ + +#question("Assignment Q3", [ + Suppose we are aiming for a precision of $t= 2/pi abs(gamma)$. +]) + +/* +$ bb(P)(abs(theta - j 2^(-m)) <= 2^(-t-1)) &= bb(P)(theta in ]j 2^(-m)-2^(-t-1), j 2^(-m)+2^(-t-1)[) \ + &= bb(P)(union_(k=j 2^(-m)-2^(-t-1))^(j 2^(-m)+2^(-t-1))(theta=k)) \ + &= sum_(k=j 2^(-m)-2^(-t-1))^(j 2^(-m)+2^(-t-1))bb(P)(theta=k) \ + &= sum_(k=0)^(2^(-t))bb(P)(theta=k+j 2^(-m)-2^(-t-1)) \ + &= sum_(k=0)^(2^(-t))p_(k+j 2^(-m)-2^(-t-1)) \ + &= 1/2^(2m)sum_(k=0)^(2^(-t)) + abs( 1-e^(2 pi i (2^m theta - j)) )^2 + /abs(1-e^(2 pi i (theta - 2^(-m)j)))^2 \ + &<= 1/2^(2m)sum_(k=0)^(2^(-t)) + abs( 1-e^(2 pi i (2^m theta - j)) )^2 + /(2/pi abs(2 pi (theta - 2^(-m)j)))^2 \ + &= 1/2^(2m)sum_(k=0)^(2^(-t)) + abs( e^(pi i (2^m theta - j))(e^(pi i (2^m theta - j)) - e^(-pi i (2^m theta - j))) )^2 + /(2/pi abs(2 pi (theta - 2^(-m)j)))^2 \ + &= 1/2^(2m)sum_(k=0)^(2^(-t)) + abs(2 i sin(pi i (2^m theta -j)) e^(pi i (2^m theta - j)) )^2 + /(2/pi abs(2 pi (theta - 2^(-m)j)))^2 + + $*/ diff --git a/qcs.typ b/qcs.typ new file mode 100644 index 0000000..806704b --- /dev/null +++ b/qcs.typ @@ -0,0 +1,22 @@ +#import "@preview/showybox:2.0.1": showybox +#import "@preview/physica:0.9.3": * + +#let question(title, content) = { + showybox( + frame: ( + border-color: blue.darken(50%), + title-color: blue.lighten(60%), + body-color: blue.lighten(80%) + ), + title-style: ( + color: black, + weight: "regular", + align: center + ), + shadow: ( + offset: 3pt, + ), + title: title, + (content) + ) +}