% Copyright (C) 2023 <Mark (mark@betalupi.com)>
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% You may have received a copy of the GNU General Public License
% along with this program. If not, see <https://www.gnu.org/licenses/>.
%
%
%
% If you edit this, please give credit!
% Quality handouts take time to make.

% use the [nosolutions] flag to hide solutions,
% use the [solutions] flag to show solutions.
\documentclass[
	solutions,
	singlenumbering,
	unfinished
]{../../resources/ormc_handout}
\usepackage{../../resources/macros}

\def\ket#1{\left|#1\right\rangle}
\def\bra#1{\left\langle#1\right|}

\usepackage{units}
\input{tikzset}


\uptitlel{Advanced 2}
\uptitler{Winter 2022}
\title{Intro to Quantum Computing}
\subtitle{Prepared by \githref{Mark} on \today{}}


\begin{document}

	\maketitle

	\input{parts/00.00 bits}
	\input{parts/00.01 two bits}
	\input{parts/02.00 half a qubit}
	\input{parts/02.01 two halves}
	\input{parts/03.00 logic gates}
	\input{parts/03.01 quantum gates}

\end{document}

\problem{}
The SWAP gate swaps two bits: $\text{SWAP}\ket{ab} = \ket{ba}$. \par
Find its matrix.

\begin{solution}
	\begin{equation*}
		\text{SWAP} = \begin{bmatrix}
			1 & 0 & 0 & 0 \\
			0 & 0 & 1 & 0 \\
			0 & 1 & 0 & 0 \\
			0 & 0 & 0 & 1 \\
		\end{bmatrix}
	\end{equation*}
\end{solution}

\vfill









% \problem{}
% The $T$ gate is a three-bit gate that inverts its right bit iff its left and middle inputs are both $\ket{1}$. \par
% In other words, $T\ket{11x} = \ket{11}\ket{\text{not } x}$, and $T\ket{abx} = \ket{abx}$ for all other inputs. \par
% Find the $T$ gate's matrix. \par
% \note{
% 	This gate is particularly interesting because it's a \textit{universal quantum gate}: \\
% 	like NOR and NAND in classical logic, any quantum gate may emulated by only applying $T$ gates.
% }
%
% \begin{solution}
% 	\begin{equation*}
% 		\text{T} = \begin{bmatrix}
% 			1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
% 			0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\
% 			0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\
% 			0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\
% 			0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\
% 			0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\
% 			0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\
% 			0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\
% 		\end{bmatrix}
% 	\end{equation*}
% \end{solution}