-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tex
More file actions
2977 lines (2342 loc) · 190 KB
/
Copy pathmain.tex
File metadata and controls
2977 lines (2342 loc) · 190 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{mathtools}
\newcommand{\quotes}[1]{``#1''}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{siunitx}
\usepackage{ragged2e}
\usepackage{caption}
\usepackage{titling}
\usepackage{afterpage}
\usepackage{listings}
\usepackage{lipsum}
\usepackage{courier}
\usepackage{natbib}
\captionsetup[table]{skip=10pt}
\newcommand{\from}[2]{{\bf[{\sc from #1:} #2]}}
\newcommand\norm[1]{\left\lVert#1\right\rVert}
\newcommand{\mybinom}[2]{\Bigl(\begin{array}{@{}c@{}}#1\\#2\end{array}\Bigr)}
\newcommand\blankpage{%
\null
\thispagestyle{empty}%
\addtocounter{page}{-1}%
\newpage}
\renewcommand\maketitlehooka{\null\mbox{}\vfill}
\renewcommand\maketitlehookd{\vfill\null}
\lstset{basicstyle=\footnotesize\ttfamily,breaklines=true}
\lstset{numbers=left,xleftmargin=3em,framexleftmargin=1.5em}
\title{Quantum Computing}
\author{Matteo Madeddu}
\date{Draft - January 2018}
\afterpage{\blankpage}
\begin{document}
\begin{titlingpage}
\maketitle
\thispagestyle{empty}
\end{titlingpage}
\newpage
\pagestyle{empty}
\vspace*{\fill}
\begin{quote}
\centering
``\textit{Nobody understands quantum mechanics.}'' \\
\ \\
R. Feynman
\end{quote}
\vspace*{\fill}
\newpage
\pagestyle{empty}
\tableofcontents
\newpage
\pagestyle{plain}
\section*{Introduction}
\paragraph{} I should start by saying that my education background is in Computer Science. While I've read a couple of books on quantum mechanics, I don't have formal training as a physicist: that didn’t deter me from learning the generalities about quantum mechanics and play with quantum computers. In this document, I collected everything that was useful and necessary for me to fully understand the basic concepts related to this world, with particular attention to quantum computation provided by the \texttt{IBM Q} Platform\footnote{The platform I am talking about is available at \url{http://quantumexperience.ng.bluemix.net}}.
These notes are essentialy a work of refinement (I hope) and enrichment of the material made available in \cite{dipierro}, with the intention of making them, if possible, even more accessible to anyone who wants to deal with the quantum world. I followed the teacher's notes in a rather faithful way. To help me understand more in depth the concepts introduced, I introduced some more recalls of maths using as main source the notes in \cite{susskind2014quantum}.
However, I think the most important change introduced in this work with respect to the original work (\cite{dipierro}) is the integration of practical test using the platform made available by the \texttt{IBM Q} team. At the moment, they make available a real quantum computer I found really useful to understand the concepts and exercises proposed in \cite{dipierro}. The last section of the document contains a collection of exercises - with respective answers - exposed in \cite{dipierro}, collected from exams draft available online and provided by several universities, proposed by the \texttt{IBM Q} in its tutorial cycle and some other personal circuits I coded to understand better the gates available.
\newpage
\section{Physics and Computation}
\subsection{Introduction}
\paragraph{} A calculation process is essentially a physical process that is performed on a machine whose operation obeys certain physical laws. The classical theory of computation is based on an abstract model of universal machine, the Universal Turing Machine, that works according to a set of rules and principles enunciated in 1936 by Alan Turing and subsequently elaborated by John Von Neumann in the 1940s. These principles have remained essentially unchanged since then, despite the enormous technological advances that today allow to produce far more powerful devices than those that could be achieved in the first half of the twentieth century. The tacit assumption underlying these principles is that a Turing machine idealizes a mechanical computational device - with a potentially infinite memory - that obeys the laws of classical physics.
Usually the concept of \textit{difficulty} is quite subjective, but for a computer scientist this word has a different meaning: the classical information theory divides the problems that can be solved by a computer according to their complexity, i.e. the time taken by the computer to solve them according to the length of the input. Apparently, there are problems that are unsolvable, even from a computer when the dimensions of the initial parameters become relevant. For instance, it may be impossible to find the solution of a sudoku, solve the enigma of the traveling salesman or break down a number in its prime factors. However, a \textit{quantum} computer has the ability to perform multiple operations together, i.e. by \textit{quantum} parallelize tasks. Thus, in the XX century an unlikely alliance between physicists and computer scientist was born with the common goal of developing a quantum machine: computer scientists wanted to amply the class of problem solvable by machines and to overcome the limit of the classic Turing's computation theory, physicists wanted to understand a little more the mysteries of quantum mechanics. As a result of this cooperation, a series of \textit{quantum algorithms} have been structured in such a way to use a quantum phenomena such as the principle of \textit{superposition} or \textit{entanglement}: only by exploiting these properties properly, it's possible to tap into all the potential of quantum computing. What makes the quantum computer so interesting?
\subsection{Quantum computation}
\paragraph{} Quantum computation is born as an alternative paradigm based on the principles of quantum mechanics. The idea of creating a model of computation as an isolated quantum system began to appear at the beginning of the eighties, when P. Benioff, starting from considerations previously elaborated by C. Bennet, defined the reversible Turing Machine: a computation can always be executed in such a way as to return to the initial state by retracing the various steps of computation backwards.
Subsequently R. Feynman showed that no classical Turing Machine could simulate certain physical phenomena without incurring an exponential slowing of its performances. In contrast, a ``universal quantum simulator" could have performed the simulation more efficiently.
In 1985 D. Deutsch formalized these ideas in his Universal Quantum Turing Machine, which in quantum computational theory represents exactly what the Universal Turing Machine represents for classical computability and led to the modern conception of quantum computation.
Naturally, the effects of the introduction of the new calculation model were also felt in the field of computational complexity (as envisaged by Feynman), causing the change of the notion of ``treatability". In fact, in 1994 P. Shor shows that the problem of factorization of prime numbers - classically considered intractable - can be solved efficiently, i.e. in polynomial time - with a quantum algorithm. These considerations, combined with the technological ones mentioned above, have led to the emergence of the research field known today as information theory and quantum computation. In particular, the three fundamental, and not very intuitive phenomena of the quantum theory, are the \textit{principle of superposition} of states, the \textit{principle of measurement} and the \textit{phenomenon of entanglement}. To introduce them, it is necessary to introduce some concept related to the quantum world and after that some recall of mathematical algebra.
\subsection{First look at the \textit{spin}}
\label{subsec:spinExample}
\paragraph{} The concept of \textit{spin} is derived from particle physics: particles have properties in addition to their location in space. For instance, they may or may not have electric charge, or mass. But, even a specific type of particle, such as an electron, is not completely specified by its location. Attached to the electron is an extra degree of freedom called its \textit{spin}. Naively, the spin can be pictured as a little \textit{arrow} that points in some directions, but that naive picture is too classical to accurately represent the real situation. The spin of an electron is about \textit{as quantum as quantum mechanical as a system can be}, and any attempt to visualize it classically will badly miss the point.
Let's abstract the idea of a spin and forget that it is attached to an electron. The quantum spin is a system that can be studied in its own right: in fact, it is isolated from the electron that carries it through space and is both the simplest and \textit{the most quantum of systems}.
The isolated quantum spin is an example of the general class of simple systems called qubits - \textit{quantum bits} - that play the same role in the quantum world as logical bits play in defining the state of your computer. I will talk about qubit more in depth in \autoref{sec:quantumBit}. Many systems - maybe even all systems - can be built up by combining qubits.
\subsubsection{Classical deterministic system}
\paragraph{} The very simplest classical deterministic system is the one involving a coin that can show either heads ($H$) or tails ($T$). This is the equivalent of a bit, with the two states being $H$ - head - or $T$ - tail: there is one ``degree of fredom" called $\sigma$, with two possible values - namely $+1$ and $-1$. The state $H$ is replaced by
$$\sigma = +1$$
and the state $T$ by
$$\sigma = -1$$
Classically, that's all: the system is either in state $\sigma = +1$ or $\sigma = -1$ and there is nothing in between. In quantum mechanics, we'll think of this system as a qubit.
For completeness, let's introduce a simple evolution laws that tell us how to update the state from instant to instant. The simplest law is just that nothing happens: in that case, if we go from one discrete instant ($n$) to the next ($n+1$), the law of evolution is
\begin{equation*}
\sigma(n + 1) = \sigma(n)
\end{equation*}
\subsubsection{Make measurements vs record results}
\paragraph{} The \textit{foundamental point} to understand about quantum world is that an experiment involves more than just a system to study: in fact, it also involves an \textit{apparatus} - from this point $\mathcal{A}$ - to make measurements and record the results of the measurements you made.
In the case of the two-state quantum system - the spin of an electron - described before, the apparatus interacts with the system and records the value of $\sigma$. Think of the apparatus as a \textit{black box}, without any cat in it but a window that displays the result of a measurement. There is also a ``this end up" arrow on the apparatus. The up-arrow is important because it shows how the apparatus is \textit{oriented} in space, because \textit{its direction will affect the outcomes of our measurement}.
\begin{figure}[!htb]
\begin{center}
\includegraphics[width=4.5in]{images/spinExp1.png}
\caption{A first measurement.}
\label{fig:spinExp1}
\end{center}
\end{figure}
For the first experiment, the black box points along the $z$ axis, as shown in \autoref{fig:spinExp1}. Initially you don't have no knowledge of whether $\sigma = +1$ or $\sigma = -1$: the purpose of the experiment is to find out the value of $\sigma$.
Before the apparatus \textit{interacts} with the spin, the window is blank: after the measurements of $\sigma$, the question mark disappears and the window shows a $+1$ or a $-1$. Now that you measured $\sigma$, let's reset the apparatus to neutral and, without \textit{disturbing} the spin, measure $\sigma$ again.
Assuming the spin evolution law, you should get the same answer got after the first measurement: thus, the result $\sigma = +1$ will be followed by $\sigma = +1$, likewise for $\sigma = -1$. Further, this sequence of results will be true for any number of repetitions, allowing you to confirm the result of an experiment: in a sense, the first interaction with the apparatus $\mathcal{A}$ \textit{prepares} the system in one of the two states. Subsequent experiments \textit{confirm} that state. So far, there is no difference between classical and quantum physics: at least for now.
\subsubsection{Introducing some rotations}
\paragraph{} Let's do something new. After preparing the spin by measuring it with $\mathcal{A}$, turn the apparatus upside down and then measure $\sigma$ again, as shown in \autoref{fig:spinExp2}.
\begin{figure}[!htb]
\begin{center}
\includegraphics[width=4.55in]{images/spinExp2.png}
\caption{A second measurement: the spin is \textit{prepared} and then measured again with the apparatus rotated by 180 degree.}
\label{fig:spinExp2}
\end{center}
\end{figure}
What we find is that if you originally prepared $\sigma = +1$, the upside down apparatus records $\sigma = -1$. Similarly, if we originally prepared $\sigma = -1$, the upside down apparatus records $\sigma = +1$. In other words, turning the apparatus over \textit{interchanges} $\sigma = +1$ and $\sigma = -1$. From these results, you might conclude that $\sigma$ is a ``degree of freedom" that is associated with a sense of direction in space.
For instance, if $\sigma$ were an oriented vector of some sort, then it would be natural to expect that turning the apparatus over would reverse the reading. A simple explanation is that the apparatus measures the componet of the vector along the axis embedded in the apparatus. The question is now: is this explanation correct for all configurations of spin and/or apparatus direction?
If you are convinced that the spin is a vector, you would naturally describe it by three components, or degree of freedom: $\sigma_z, \; \sigma_x, \; \sigma_y$. When the apparatus is upright along the $z$ axis, it is positioned to measure $\sigma_z$.
So far, there is still no difference between classical physics and quantum physics. The difference only becomes apparent when you rotate the apparatus through an arbitrary angle, say $\frac{\pi}{2}$, or $\ang{90}$ degrees. The apparatus begins in the upright position, i.e. with the up-arrow along the $z$ axis. A spin is prepared with $\sigma = +1$. Next, the apparatus $\mathcal{A}$ is rotated so that the up-arrow points along the $x$ axis as shown in \autoref{fig:spinExp3}, and then make a measurement of what is presumably the $x$ component of the spin, $\sigma_x$.
\begin{figure}[!htb]
\begin{center}
\includegraphics[width=4.55in]{images/spinExp3.png}
\caption{A third measurement over the x component of the spin.}
\label{fig:spinExp3}
\end{center}
\end{figure}
If $\sigma$ really represents the components of a vector along the up-arrow, one would expect to get zero. Why? Initially, we confirmed that $\sigma$ was directed along the $z$ axis, suggesting that its component along $x$ must be zero. However, after the $\sigma_x$ measurement, instead of giving $\sigma_x = 0$, the apparatus $\mathcal{A}$ gives either $\sigma_x = +1$ or $\sigma_x = -1$. Furhter, no matter which way $\mathcal{A}$ is oriented, it refuses to give any answer other than $\sigma = \pm1$.
Nevertheless, we do find something interesting. Suppose we repeat the operation many times, each time following the same procedure, that is:
\begin{itemize}
\item Beginning with $\mathcal{A}$ along the $z$ axis, prepare $\sigma = +1$.
\item Rotate the apparatus so that it is oriented along the $x$ axis.
\item Measure $\sigma$.
\end{itemize}
\paragraph{An important difference} The repeated experiment spits out a random series of plus-ones and minus-ones. Determinism has broken down, but in a particular way. if we do many repetitions, we will find that the numbers of $\sigma = +1$ events and $\sigma = -1$ events are statistically equal. In other words, the average value of $\sigma$ = 0. Instead of the classical result - namely, that the component of $\sigma$ along the $x$ axis is zero - we find that the \textit{average of these repeated measurements} is zero.
If the spin is a vector, it is a very peculiar one indeed.
\subsubsection{A strange vector}
\paragraph{} Let's do the whole thing over again, but instead of rotating $\mathcal{A}$ to lie on the $x$ axis, rotate it to an arbitrary direction along the unit vector $n$. Classically, if $\sigma$ were a vector, you would expect the result of the experiment to be the component of $\sigma$ along the $n$ axis. If $n$ lies at an angle $\theta$ with respect to $z$, the classical answer would be $\sigma = cos(\theta)$. But as you might guess, each time we do the experiment we get $\sigma = +1$ or $\sigma = -1$. However, the result is statistically biased so that the average value is $cos(\theta)$.
\begin{figure}[!htb]
\begin{center}
\includegraphics[width=4.55in]{images/spinExp4.png}
\caption{An arbitrary rotation and measurement of the spin component.}
\label{fig:spinExp4}
\end{center}
\end{figure}
The situation is of course more general. We did not have to start with $\mathcal{A}$ oriented along $z$. Pick any direction $m$ and start with the up-arrow pointing along $m$. Prepare a spin so that the apparatus reads $+1$. Then, without disturbing the spin, rotate the apparatus to the direction $n$, as shown in \autoref{fig:spinExp4}. A new experiment on the same spin will give random results $\pm 1$, but with an average value equal to the cosine of the angle between $n$ and $m$. In other words, the average will be $n \cdot m$.
The quantum mechanical notation for the statistical average of a quantity $Q$ is Dirac's bracket notation\footnote{The Dirac notation is foundamental in quantum mechanics: more on that will be said in the mathematical recall.} $\langle Q\rangle$. You may summarize the results of the experimental investigation as follows: if you begin with $\mathcal{A}$ oriented along $m$ and confirm that $\sigma = +1$, then subsequent measurements with $\mathcal{A}$ oriented along $n$ gives the statistical result
$$\langle\sigma\rangle = n \cdot m$$
What I'm saying is that quantum mechanical systems are not deterministic - the results of experiments can be statistically random - but if we repeat an experiment many times, average quantities can follow the expectations of classical physics, at least up to a certain point.
\subsection{A different kind of logic}
\paragraph{} Every experiment involves an outside system - an apparatus that must interact with the system in order to record a result: in that sense, every experiment is \textit{invasive}. In fact, each first lessons of physics starts - at least, should - by removing from students the idea of obtaining any kind of absolute precise measure of a system or one of its characteristics. This is impossible, even in classical physics. However, an ideal measuring apparatus has often a vanishingly small effect on the system it is measuring.
\subsubsection{Quantum mechanics: the effect of interactions}
\paragraph{} In quantum mechanics, the situation if foundamentally different. Any interaction that is strong enough to measure some aspect of a system is \textit{necessarily strong enough} to disrupt some other aspect of the same system. Thus, you can learn nothing about a quantum system without changing something else.
This should be evident in the example involving $\mathcal{A}$ and $\sigma$. Suppose you begin with $\sigma = +1$ along the $z$ axis. If you measure $\sigma$ again with $\mathcal{A}$ oriented along $x$, you will confirm the previous value. You can do this over and over without changing the result. But consider this possibility: between subsequent measurements along the $x$ axis, you turn $\mathcal{A}$ through $\ang{90}$ degrees, make an intermediate measurement, and turn it back to its original direction. Will a subsequent measurement along the $z$ axis confirm the original measurement?
The answer is no. The intermediate measurement along the $x$ axis will leave the spin in a completely random configuration, as far as the next measurement is done. There is no way to make the intermediate determination of the spin without completely disrupting the final measurement. One might say that measuring one component of the spin destroys the information about another component. In fact, one simply cannot \textit{simultaneously} know the components of the spin along two different axes - at least, not in a reproducible way in any case.
This is to say that there is something fundamentally different about the state of a quantum system and the state of a classical system.
\subsubsection{Measurements order matters}
\paragraph{} The space of states of a classical system is a mathematical set. If the system is a coin, the space state is $\{H,T\}$. As in classical boolean logic, also in set theory there is, in a sense, the concept of ``nothing other than true or false is allowed": this concept is expressed by the subset. Roughly, we can say that a proposition is true if it is true \textit{for each elements it contains} in its subset and false for each other elements. What does it mean? For instance, the sentence ``the die shows an odd-numbered face" about the system ``die" is \textit{true} if - for each elements of its subset $\{1,3,5\}$ - is \textit{true} and \textit{false} for each others. There are no other possibilieties\footnote{Just kidding: have a look at default logic and non-monotonic reasoning.}. Further, propositions could be mixed with logical operators like \texttt{OR}, \texttt{AND} and \texttt{NOT}.
Let's return to the simple quantum system consisting of a single spin and the various propositions whose truth we could test using the apparatus $\mathcal{A}$. Consider the following sentences:
\begin{itemize}
\item A: the $z$ component of the spin is $+1$;
\item B: The $x$ component of the spin is $+1$;
\item $\neg$A: The $z$ component of the spin is $-1$;
\item A \texttt{OR} B: The $z$ component of the spin is $+1$ or the $x$ component of the spin is $+1$;
\item A \texttt{AND} B: The $z$ component of the spin is $+1$ or the $x$ component of the spin is $+1$;
\end{itemize}
Imagine we have to test the truth of the $4$-th sentence: we can use the apparatus $\mathcal{A}$, measure $\sigma_z$ and, if it's equal to $-1$, go ahead with measurement of $\sigma_x$.
What happens if we change the order of measurements in a classical system - a one in which the spin is a normal vector? You will obtain the same result from both the measurements. However, we don't know yet how a spin works, but we already verified that is not a definetily not classical system.
Let's do it in the quantum way: you measure $\sigma_z$, you discover $\sigma_z = +1$. A \texttt{OR} B is true. Now, suppose you want to test also $\sigma_x$: the answer is unpredictable. This is not a problem, because the sentence A \texttt{OR} B remains true.
Now, let's try to repeat the measure inverting the order and testing B \texttt{OR} A. First, the measure of $\sigma_x$ is random because the first measure of $z$ (in A \texttt{OR} B experiment) set the $\sigma_z = +1$. So, let suppose the result is $\sigma_x = +1$: than, B \texttt{OR} A is true. However, if the result is $\sigma_x = -1$, then it means that the spin is oriented along the $-x$ direction. And this is strange, because the spin is no longer in its original state $\sigma_z = +1$, but in a new state that is either $\sigma_x = +1$ or $\sigma_x = -1$.
Now, test the second half of B \texttt{OR} A: in other words, rotate the apparatus $\mathcal{A}$ and measure $\sigma_z$. According to quantum mechanics, the result will be randomly $\pm 1$: this means that there is a $25\%$ probability that the experiment produces $\sigma_x = -1$ and $\sigma_z = -1$. In other words, with a probability equal to $1/4$ we find that B \texttt{OR} A is false. And this occurs despite the fact the there is unknown agent that originally made sure that $\sigma_z = +1$ (see first experiment).
The point is that the inclusive \texttt{OR} is not \textit{symmetric}: the truth of A \texttt{OR} B may depend on the order in which you confirm the two propositions.
\subsubsection{The uncertainty principle}
\paragraph{} At this point, you probably recognize that the result of the experiments we conducted are due to the famous uncertainty principle: this doesn't apply only to position and momentum (or velocity), but it applies to many pairs of measurable quantities. In the case of the spin, it applies to propositions involving two different components of $\sigma$. In the case of position and momentum, the two propositions we might consider are:
\begin{itemize}
\item A certain particle has position $z$;
\item The same particle has momentum $p$;
\end{itemize}
From these, we can form the two composite propositions
\begin{itemize}
\item The particle has position $x$ and the particle has momentum $p$;
\item The particle has position $x$ or the particle has momentum $p$;
\end{itemize}
In quantum mechanics, the first of these propositions is completly meaningless (not even wrong), and the second one means something quite different from someone could think normally. It all comes down to a deep logical difference between the classical and quantum concepts of the state of a system. But explaining quantum concepts require some mathematics concept first: to make these notes more useful for other, I collected all the maths needed to understand the concept exposed in the subsequent sections in a unique section, the next one. Every time I will refer to a particular mathematical properties, theorems, axioms, and so on, I will insert a reference back to the point in which it is discussed.
\newpage
\section{Mathematical Interpretation}
\paragraph{} A qubit is described as an \textit{abstract mathematical object} that enjoys certain particular properties. The physical nature of this object will be clarified later by observing the correspondence between the properties of a qubit with those of any two-state quantum system: some features of this system were already discussed in the previous example (see \autoref{subsec:spinExample}).
In this section, I will introduce - as clearly as possible - some definitions and notations needed to understand the mathematical model of the qubit, the operations you can do on it and the laws the govern the quantum world: many of the following exposed concepts are fundamental for understanding the physical phenomena underlying quantum computation.
My advice is to spend all the time necessary to understand these basic and easy-to-understand concepts, and to return to this section whenever you don't remember somethings. Enjoy the reading!
\subsection{Vectorial Space}
\paragraph{} The \textbf{two-dimensional real vector space} ${\mathbb{R}}^2$ is the set of column vectors
\begin{equation}
v = \binom{a}{b}
\label{eq:vectorInR2}
\end{equation}
where $a, b \in \mathbb{R}$ are real numbers.
\paragraph{} The \textbf{norm} of $v$ is given by
\begin{equation}
|v| = \sqrt{a^2 + b^2}
\label{eq:vectorNormInR2}
\end{equation}
\paragraph{} The \textbf{transposed} of $v$ is the vector line
\begin{equation}
v^T = (a, b)
\label{eq:vectorTransposedInR2}
\end{equation}
\paragraph{} The \textbf{scalar product} - also called \textbf{inner} or \textbf{internal} product - of two vectors
\begin{equation*}
v_1 = \binom{a_1}{b_1}, v_2 = \binom{a_2}{b_2}
\end{equation*}
is given by
\begin{equation}
v_1 \cdot v_2 \stackrel{\text{def}}{\equiv} v_1^Tv_2 = (a_1, b_1) \binom{a_2}{b_2} = a_1 a_2 + b_1 b_2 = \norm{v_1}\norm{v_2}cos{\theta}
\label{eq:vectorScalarProductInR2}
\end{equation}
where ${\theta}$ is the angle between $v_1$ and $v_2$.
\paragraph{} Two vectors $v_1, v_2$ are \textbf{orthogonal} if $v_1 \cdot v_2 = 0$.
\paragraph{} The vectors ${v_i \in {\mathbb{R}} \; | \; i = 1, 2,\ldots k}$ are \textbf{linearly independent} if
\begin{equation}
a_1v_1 + a_2v_2 + \ldots + a_kv_k = 0, \; \; a_i \in {\mathbb{R}}
\label{eq:vectorLinearIndipendentInR2}
\end{equation}
This implies that $a_i = 0$ for each $i = 1, 2, \ldots, k$. Otherwise they are called \textbf{linearly dependent}.
\subsection{Orthonormal Bases}
\paragraph{} A \textbf{basis} of ${\mathbb{R}}^2$ is any set of linearly independent vectors such that any other vector in ${\mathbb{R}}^2$ can be expressed as a linear combination of the vectors in the set. Each pair/set of $v_1$ and $v_2$ linearly independent vectors form a base for ${\mathbb{R}}^2$/${\mathbb{R}}^n$.
\paragraph{} Further, $v_1$ and $v_2$ form an \textbf{orthonormal basis} for ${\mathbb{R}}^2$ if $\norm{v_1} = \norm{v_2} = 1$ \textbf{and} $v_1 \cdot v_2 = 0$.
Consequently, the two vectors
\begin{equation}
\binom{1}{0} \; \; \; \binom{0}{1}
\label{eq:standardBaseInR2}
\end{equation}
form an orthonormal basis for ${\mathbb{R}}^2$ called the \textbf{standard base} of ${\mathbb{R}}^2$.
\paragraph{} In ${\mathbb{R}}^2$ and ${\mathbb{R}}^3$, the most common basis are the 2/3 unit vectors that point along the $x, y$ and $z$ axes. Obviously, there is nothing special about this particolar axis: as long as the basis vectors are of unit length and are mutually orthogonal, they form an orthonormal basis.
The same principle is true for complex vector spaces. One can begin with any normalized vector and then look for a second, orthogonal to the first. If you find one, then the space is at least two-dimensional. Then look for a third, fourth, and so on. Eventually, you may run out of new directions and there will not be any more orthognal vectors is the dimension of the space.
The point is: the maximum number of mutually orthogonal vectors is the dimension of the space. For column vectors, the dimensions is simply the number of entries in the column.
\subparagraph{Gram-Schmidt}
\label{subpar:gramschmidt}
It is always possible to transform any base for a $V$ vector space into an orthonormal base. The method for doing so is called the Gram-Schmidt procedure: thanks to this procedure we can assume that the bases we will consider from now on are always orthonormal.\from{Matteo}{Eventually extend this with explanation by Susskind.}
\paragraph{Exercise} Look exercises number 1 in \autoref{exs}.
\paragraph{} Before going on with the qubits definitions, we first introduce the definition of a complex numbers and some basic properties defined on them.
\subsection{Complex Numbers}
\paragraph{} A \textbf{complex number} $z$ is a number expressed in the form
\begin{equation}
z = a + ib
\label{eq:complexNumber}
\end{equation}
where $a, b \in {\mathbb{R}}$ are real numbers and $i = \sqrt{-1}$ is the imaginary unit. For further notation, we call $a = Re(z)$ the real part of $z$ and $b = Im(z)$ the imaginary part.
\paragraph{} The \textbf{norm} or \textbf{module} of a complex number $z \in \mathbb{C}$ is
\begin{equation}
|z| = \sqrt{a^2 + b^2}
\label{eq:complexNumberNorm}
\end{equation}
\paragraph{} Each complex number has a sort of \textit{dual}, called \textbf{complex conjugate}: given a complex number $z \in \mathbb{C}$, its conjugate is
\begin{equation}
z^* = a - ib
\label{eq:complexNumberConjugate}
\end{equation}
\paragraph{} The \textbf{two-dimensional complex vector space} ${\mathbb{C}}^2$ is the set of column vectors of the form
\begin{equation}
w = \binom{\alpha}{\beta}
\label{eq:twoDimensionalComplexVectorSpace}
\end{equation}
with ${\alpha}, {\beta} \in {\mathbb{C}}^2$.
\paragraph{} The \textbf{norm} of the two-dimensional complex vector $w \in {\mathbb{C}}^2$ is given by
\begin{equation}
\norm{w} = \sqrt{|\alpha|^2 + |\beta|^2}
\label{eq:complexVectorNorm}
\end{equation}
where $|z|$ is the module of the complex number $z$. So, given $\alpha = a_1 + ib_1$ and $\beta = a_2 + ib_2$, then the norm of the vector $w^T = (\alpha, \beta)$ is given by
\begin{equation*}
\norm{w} = \sqrt{|\alpha|^2 + |\beta|^2} = \sqrt{\left|\sqrt{a_1^2 + b_1^2}\right|^2 + \left|\sqrt{a_2^2 + b_2^2}\right|^2} = \sqrt{a_1^2 + b_1^2 + a_2^2 + b_2^2}
\end{equation*}
\paragraph{} The \textbf{complex conjugate} of the two-dimensional complex vector $w = \binom{\alpha}{\beta} \in {\mathbb{C}}^2$ is the linear vector
\begin{equation}
w^\dagger = {(w^{T})}^{*} = {(w^{*})}^{T} = (\alpha^*, \beta^*)
\label{eq:twoDimensionalComplexVectorConjugate}
\end{equation}
with $(\alpha^*, \beta^*)$ the two \textbf{complex conjugate} of $\alpha$ and $\beta$.
\paragraph{} The \textbf{scalar product} - also called \textbf{inner} or \textbf{internal} product - of two complex vectors
$$w_1 = \binom{\alpha_1}{\beta_1} \; \; \; w_2 = \binom{\alpha_2}{\beta_2}$$
is defined as
\begin{equation}
w_1 \cdot w_2 \stackrel{\text{def}}{=} w_1^\dagger w_2 = (\alpha_1^*, \beta_1^*) \binom{\alpha_2}{\beta_2} = \alpha_1^* \alpha_2 + \beta_1^*\beta_2
\label{eq:complexVectorScalarProductInC2}
\end{equation}
Remember that - given $z_1 = a + ib$ and $z_2 = c + id$ ($z_1, z_2 \in {\mathbb{C}}^2$), the product $z_1 z_2$ is
\begin{equation*}
\begin{split}
z_1z_2 & = (a + ib) (c + id) = ac + aid + ibc + ibid = \\
& = ac + aid + ibc - bd = ac - bd + i(ad + bc) \\
\end{split}
\end{equation*}
\paragraph{} The definitions of linear, base, and orthonormal independence are similar to those for ${\mathbb{R}}^2$.
Consequently, the two vectors
\begin{equation}
\binom{1}{0} \; \; \; \binom{0}{1}
\label{eq:canonicalBaseInC2}
\end{equation}
form an orthonormal basis for ${\mathbb{C}}^2$ called \textbf{canonical basis}.
\subsection{The Dirac notation}
\label{diracNotation}
\paragraph{} To represent the elements of a complex vector space it is convenient to use a notation called \textbf{Dirac notation} from the name of the famous English physicist, pioneer of quantum theory, who introduced it: the Dirac notation represents the standard notation in quantum mechanics.
According to this notation, $|v\rangle$ or \textbf{ket} indicates a generic element of the vector space ${\mathbb{C}}^2$.
As shown before, the complex numbers have a \textit{dual} version in the form of complex conjugate numbers. In the same way, a complex vector space has a dual version that is essentialy the complex conjugate vector space. Thus, for every ket-vector $|v\rangle$ there is a \textbf{bra} vector denoted by $\langle v|$ belonging to the complex conjugate of the vector space. There are some simple properties to remember between bras and kets.
Suppose that $\langle v$ is the bra corresponding to the ket $|v\rangle$, and $\langle w$ is the bra corresponding to the ket $|w\rangle$. Then the bra corresponding to
\begin{equation*}
|v\rangle + |w\rangle
\end{equation*}
is
\begin{equation*}
\langle v| + \langle w|
\end{equation*}
If $z$ is a complex number, then the bra corresponding to
\begin{equation*}
z|v\rangle
\end{equation*}
is
\begin{equation*}
\langle v|z^*
\end{equation*}
In the concrete example, where \textit{kets} are represented by column vectors, the dual \textit{bras} are represented by row vectors, with the entries being drawn from the complex conjugate numbers. Thus, if the ket $|a\rangle$ is represented by the column
\begin{equation*}
\begin{pmatrix}
\alpha_1\\
\vdots\\
\alpha_d
\end{pmatrix}
\end{equation*}
then the corresponding bra $\langle a|$ is represented by the row
\begin{equation}
(\alpha_1, \alpha_2, \ldots, \alpha_d)
\label{eq:braOfKetDefinition}
\end{equation}
% If $|v\rangle$ or \textbf{ket} indicates a generic element of the vector space, $|i\rangle$ indicates the $i_{th}$ element of the canonical orthonormal basis. If $|v\rangle = \sum\limits_{i}{\alpha_i|i\rangle}$ e $|w\rangle = \sum\limits_{i}{\beta_i|i\rangle}$, then their scalar product
% $$(\alpha_1, \alpha_2, \ldots, \alpha_d) \; \begin{pmatrix}
% \beta_1\\
% \vdots\\
% \beta_d
% \end{pmatrix}
% $$
% is indicated with $\langle v | w\rangle$. The $\langle v | w\rangle$ form a \textbf{braket}.
% More in general, in the concret example where kets are represented by column vectors, the dual bras are represented by row vectors: the bras are the complex conjugate of their respective kets.
% \from{Matteo}{Integrate with Susskind and Friedman lesson.}
% The definition implies that each internal product satisfies the following property:
% $$\sum\limits_{i}(a_i|w_i\rangle, |v\rangle) = \sum\limits_{i}a_i^{*}(|w_i\rangle, |v\rangle)$$
% In Dirac's notation, the internal product of vector $|v\rangle$ with vector $|w\rangle$ is denoted by $\langle v|w\rangle$. Using the internal product, you can define the norm of a vector as
% $$||v|| = \sqrt{\langle v\rangle}$$
The usefulness of this notation will be particularly evident to study quantum measurement and in particular projection operators.
\subsection{Internal product}
\paragraph{} The formal definition of a internal product is the following: given a vector space $V$, a function $(\cdot, \cdot): V \times V \mapsto \mathbb{C}$ is called internal or inner or scalar product if it meets the following requirements:
\begin{itemize}
\item $(|v\rangle, |v\rangle) \geq 0$
\item $(|v\rangle, |v\rangle) = 0 \leftrightarrow v = 0$
\item $(|v\rangle, |w\rangle) = (|w\rangle, |v\rangle)*$
\item $(|v\rangle, \sum\nolimits_{i}a_i|w_i\rangle) = \sum\nolimits_{i}a_i(|v\rangle, |w_i\rangle)$
\end{itemize}
From a practical point of view, the internal or inner or scalar product is the dot product analogous operation between bras and kets. In fact, the inner product is always the product of a bra and a ket and it is written this way:
$$\langle B|A\rangle$$
In the concrete representation of bras and kets by row and column vectors, the inner product is defined in terms of components:
$$\langle B|A\rangle = (\beta_1^*, \beta_2^*)\binom{\alpha_1}{\alpha_2} = \beta_1^*\alpha_1 + \beta_2^*+\alpha_2$$
The rule to compute inner product is essentially the same as for dot products: add the products of corresponding components of the vectors whose inner product is being calculated. The result of the inner product operation is a complex number. The axioms for inner product are not too hard to guess:
\begin{itemize}
\item It is linear, so $\langle C| \{|A\rangle + |B\rangle\} = \langle C|A\rangle + \langle C|B\rangle$
\item Changing bras and kets corresponds to complex conjugation, so
$$\langle B|A\rangle = \langle A|B\rangle^*$$
\end{itemize}
The second could no seems so obvious, but it's easy to verify. Let be $\langle B| = (\beta_1^*, \beta_2^*)$ and $|A\rangle = \binom{\alpha_1}{\alpha_2}$. Thus, the inner product between them is $\beta_1^*\alpha_1 + \beta_2^*\alpha_2$.
Now, consider the corresponding ket of the bra $\langle B|$ and bra of the ket $|A\rangle$: so, $|B\rangle = \binom{\beta_1}{ \beta_2}$ and $\langle A| = (\alpha_1*, \alpha_2*)$. Thus, the inner product between them is $\alpha_1^*\beta_1 + \alpha_2^*\beta_2$.
Let's define $\alpha_i = x_i \pm iy_i$ (plus or minus if you are considering the conjugate or not) and $\beta_i = z_i \pm iw_i$. Then
\begin{equation*}
\begin{split}
\beta_1^*\alpha_1 + \beta_2^*\alpha_2 & = (z_1 - iw_1)(x_1 + iy_1) + (z_2 - iw_2)(x_2 + iy_2) = \\
& = z_1x_1 + iz_1y_1 -iw_1x_1 + w_1y_1 + \\
& + z_2x_2 + iz_2y_2 -iw_2x_2 + w_2y_2 \\
& = (z_2x_2 + w_2y_2) + i(z_2y_2 - w_2x_2) \\
& \ \\
\alpha_1^*\beta_1 + \alpha_2^*\beta_2 & = (x_1 - iy_1)(z_1 + iw_1) + (x_2 - iy_2)(z_2 + iw_2) = \\
& = x_1z_1 + ix_1w_1 -iy_1z_1 + y_1w_1 + \\
& + x_2z_2 + ix_2w_2 -iy_2z_2 + y_2w_2 + \\
& = (z_2x_2 + w_2y_2) - i(z_2y_2 - w_2x_2) \\
\end{split}
\end{equation*}
To make equal the two expression, you have to compute the conjugate of the second. So, $\langle B|A\rangle = \langle A|B\rangle^*$. Q.E.D.
\paragraph{} A \textit{normalized vector} is a vector such that the inner product with itself is $1$, so a normalized vector is $\langle A|A\rangle = 1$. For ordinary vectors, the term \textit{normalized} is usually replaced with \textit{unit vector}.
\paragraph{} Since two vectors are orthogonal if their inner product is equal to $0$, then the two vectors in the example before are orthogonal if $\langle B|A\rangle = 0$. This is the same of saying that two real vector are orthogonal if their dot product is zero.
\subsection{Hilbert spaces}
\paragraph{} The ${\mathbb{C}}^2$ vector space with its scalar product is called the two-dimensional \textbf{Hilbert space}. More formally, a Hilbert space is a vector space $V$ with internal and complete product compared to the metric induced by the $|\cdot|$ norm. For the sake of completeness, it is meant that all Cauchy sequences of vectors in $V$ converge to a limit in $V$. This property is significant in the case of infinite-dimensional spaces, because for vector spaces of finite dimensions it is always satisfied.
In quantum computation, the vector spaces with which you are dealing are always of finite size. Therefore, for our purposes, the term ``Hilbert space" will be completely equivalent to ``vector space with internal product". Furthermore, in the document I usually refer to a vector space $V$, implicitly meaning that $V$ is a Hilbert space.
\paragraph{} Let's consider an $N$-dimensional space and a particular orthonormal basis of ket-vectors labeled $|i\rangle$. The label $i$ tuns from $1$ to $N$. Consider a vector $A$, written as the sum of basis vectors
$$|A\rangle = \sum\limits_{i}\alpha_i|i\rangle$$
The $\alpha_i$ are complex numbers called the \textit{components} of the vector, and to calculate them we take the inner product both sides with a basis bra $\langle j|$:
$$\langle j|A\rangle = \sum\limits_{i}\alpha_i\langle j|i\rangle$$
Next, we use the fact that the basis vectors are orthonormal. This implies that $\langle j|i\rangle = 0$ if $i \neq j$ and $\langle j|i\rangle = 1$ if $i = j$. Or, $\langle j|i\rangle = \delta_{ij}$. This makes the sum collapse to one term:
$$\langle j|A\rangle = \alpha_j$$
Thus, we see that the components of a vector are just its inner products with the basis vectors. We can rewrite the $|A\rangle$ as:
$$|A\rangle = \sum\limits_{i}|i\rangle\langle i|A\rangle$$
% \paragraph{} Before going on with the presentation of a linear operator, let's first introduce some key concepts.
% \begin{enumerate}
% \item In mathematics, a \textbf{field} is an algebraic structure composed of a non-empty set $K$ and two internal binary operations, called \textbf{sum} and \textbf{product} and usually indicated with $+$ and $*$ respectively. These enjoy properties similar to those verified by the operation of sum and multiplication on rational numbers or real or even complex.
% \item In mathematics, more precisely in linear algebra, a \textbf{linear transformation}, also called \textbf{linear application} or \textbf{linear map}, is a linear function between two vector spaces on the same field, i.e. a function that preserves vector sum and multiplication operations for a scalar. In other words, a linear transformation preserves linear combinations. In the language of abstract algebra, a linear transformation is a homomorphism of vector spaces, as it preserves the operations that characterize the vector spaces.
% \item The \textbf{Kronecker delta} is routinely defined as the tensor $\delta_{ij}$ of components:
% $$\delta _{{ij}}:=\left\{{\begin{matrix}1&{\mbox{if }}i=j\\0&{\mbox{if }}i\neq j\end{matrix}}\right.$$
% \end{enumerate}
% Let's define the concept of dual space.
% \paragraph{Dual space} Given a vector space $V$ on field $K$ of finite dimension $n$, the dual space $V^*$ is the set of all linear applications from $V$ to $K$. Fixed for $V$ a basis $(e_ {1}, \ ldots, e_ {n })$, the dual base $(e^{1}, \ldots, e^{n})$ is a basis of $V^*$ uniquely determined by the following relation:
% $$e^{i}(e_{j}) = \delta_{ij}$$
% where $\delta_{ij}$ is the Kronecker delta. Each vector $v$ of $V$ can be expressed in a univocal way as a linear combination of the elements of the base
% $$v = \sum_{i = 1}^{n}v^{i}e_{i}$$
% The result of applying $e^{i}$ on v is as follows:
% $$e^{i}(v) = e^{i} \left(\sum_{k = 1}^{n}v^{k}e_{k}\right) = \sum_{k = 1}^{n}v^{k}\delta_{ik} = v^{i}$$
% So $e^{i}$ is the application that \textit{extracts} from a vector $v$ the i-th component $v^{i}$ of its coordinates with respect to the base. This application is sometimes called a projector: it can in fact be interpreted as a projection on the line generated by $e_{i}$.
% \from{Matteo}{Check if this definition is correct.}
% \paragraph{} A function $L: \mathbb{C}^2 \mapsto \mathbb{C}^2$ is \textbf{linear} if $\forall \; \; a_1, a_2 \in \mathbb{C}, v_1, v_2 \in \mathbb{C}^2$:
% $$L(a_1v_1 + a_2v_2) = a_1L(v_1) + a_2L(v_2)$$
% Given a vector $u \in \mathbb{C}^2$, the dual of $u$ is the linear function $L_u: \mathbb{C}^2 \mapsto \mathbb{C}$ defined by $L_u(w) = (u, w) = u^\dagger w$. The $L_u$ is often identified with $u^\dagger$.
% \paragraph{} In the Dirac notation the dual of a vector $|\psi\rangle$ is denoted by $\langle\psi|$ and the scalar product of $|\psi\rangle$ and $|\phi\rangle$ is $\langle\psi|\phi\rangle$\footnote{This is by definition introduced with the Dirac notation in \autoref{diracNotation}.}. For vectors according to norm $1$ the meaning of $L_u(w) = \langle\psi|\phi\rangle$ is the projection of $w$ in the direction of $u$.
% \paragraph{Exercise} Look at exercises 8 and 9 in \autoref{exs}.
% \paragraph{} The matrix representation of a linear function $L$ in the computational basis $|0\rangle$ and $|1\rangle$ is defined starting from $L(|0\rangle)$ and $L(|1\rangle)$ as follows. Suppose that
% $$L(|0\rangle) = a_{11}|0\rangle + a_{21}|1\rangle$$
% and
% $$L(|1\rangle) = a_{12}|0\rangle + a_{22}|1\rangle$$
% Then we can write $L$ as
% $$L = a_{11}|0\rangle\langle0| + a_{21}|1\rangle\langle0| + a_{12}|0\rangle\langle1| + a_{22}|1\rangle\langle1|$$
% The matrix
% \begin{equation*}
% \begin{aligned}
% A = {\begin{bmatrix}
% a_{11} & a_{12} \\
% a_{21} & a_{22} \\
% \end{bmatrix}}
% \end{aligned}
% \end{equation*}
% is the representation matrix of $L$ in the computational basis $|0\rangle$ and $|1\rangle$.
\subsection{Linear operators}
\paragraph{} States in quantum mechanics are mathematically described as vectors in a vector space. Physicals observables - the things that you can measure - are described by linear operators. That operators corresponding to physical observables must be Hermitian as well as linear. The correspondance between operators and observables is subtle, and understanding it will take some effort.
Observables are the things you measure. For example we can make direct measurements of the coordinates of a particle: the energy, the momentum, or angular momentum of a system or the electric field at a point in space. They are also associated with a vector space but they are not state-vectors: they are things you measure like $\sigma_x$ and they are represented by linear operators. John Wheeler liked to call such mathematical objects machines: an input port and an output port. You put a vector like $|A\rangle$ in the machine and it delivers a vector $|B\rangle$ in output. To say that a machine $\mathbf{M}$ acts on a vector $|A\rangle$ and return $|B\rangle$, the notation is
$$\mathbf{M}|A\rangle = |B\rangle$$
Not every machine is a \textit{linear operator}. Linearities implies a few simple properties
\paragraph{Property 1} First of all, to be linear an operator must produce a unique result for each vector in the space.
\paragraph{Property 2} If $\mathbf{M}$ acts on a multiple of an input vector, it gives the same multiple of the output vector: more formally, given $z$ any complex number, then $\mathbf{M}|A\rangle = |B\rangle$
\paragraph{Property 3} If $\mathbf{M}$ acts on a sum of vectors, the results are simply added together.
\paragraph{} A vector $|A\rangle$ can be written in component form. If we image a $N$-dimensional space, than $|A\rangle$
$$|A\rangle = \sum\limits_{j}\alpha_j|j\rangle$$
Thus, the application of linear operator $\mathbf{M}$ over $|A\rangle$ to gete $|B\rangle$
$$\sum\limits_{j}\mathbf{M}|j\rangle\alpha_j = \sum\limits_{j}\beta_j|j\rangle$$
Now, let's take a particular base vector $\langle k|$ and make the inner product at both side
$$\sum\limits_{j}\langle k|\mathbf{M}|j\rangle\alpha_j = \sum\limits_{j}\beta_j\langle k|j\rangle$$
From a mathematical point of view, the inner product with a base vector implies the vector projection: in fact, $\langle k|j\rangle = 0$ if $j \neq k$, 1 otherwhise. So, $\sum\limits_{j}\beta_j\langle k|j\rangle = \beta_k \cdot 1 = \beta_k$.
Now, imagine for a moment that the abstract linear operator $\mathbf{M}$ is a matrix, so is composed of several component like $m_{kj}$
$$\mathbf{M} = \left(\begin{matrix}
m_{11} & m_{12} & m_{13} \\
m_{21} & m_{22} & m_{23} \\
m_{31} & m_{32} & m_{33} \\
\end{matrix}\right)$$
Let's replace the linear operator $\mathbf{M}$ with its component $m_{kj}$
$$\sum\limits_{j}m_{kj}\alpha_j = \beta_k$$
Thus,
$$\beta_1 = m_{11}\alpha_1 + m_{12}\alpha_2 + m_{13}\alpha_3$$
$$\beta_2 = m_{21}\alpha_1 + m_{22}\alpha_2 + m_{23}\alpha_3$$
$$\beta_3 = m_{31}\alpha_1 + m_{32}\alpha_2 + m_{33}\alpha_3$$
In general, when a linear operator acts on a vector it will change the direction of the vector. This means that the output of a linear operator $\mathbf{M}$ will not be the input vector multiplied by a number, but another vector instead. However, given a particular operatore there are some vectors whose direction are the same when they come out.
\subsection{Eigenvalues and eigenvectors}
\paragraph{} An eigenvector of a linear operator, such as the $\mathbf{M}$, on a vector space $V$ is a not-null vector $|\lambda\rangle \in V$ such that
\begin{equation}
\mathbf{M}|\lambda\rangle = \lambda|\lambda\rangle
\label{eq:linearOperatorDef}
\end{equation}
where $|\lambda\rangle$ is a ket-vector called \textbf{eigenvector} of $\mathbb{M}$ and $\lambda$ is a complex number, called the respective \textbf{eigenvalue}. The \autoref{eq:linearOperatorDef} implies that the $|\lambda\rangle$ ket has a very special relationship with $\mathbb{M}$: in fact, whne $|\lambda\rangle$ is fed into the machine $\mathbb{M}$, it gets multiplied by the number $\lambda$.
Linear operators can also act on bra-vectors. The notation for multiplying $\langle B|$ by $\mathbb{M}$ is
\begin{equation*}
\langle B|\mathbf{M}
\end{equation*}
Because of complex conjugation, you have to complex conjugate the matrix and transpose it. Let's recall some matrix definitions.
\paragraph{} Given a matrix $A$ with dimensions $n \times m$, the \textbf{transposed} $A^T$ is defined by
\begin{equation}
\begin{aligned}
(A^T)_{ij} = (A)_{ji}
\end{aligned}
\label{eq:transposedMatrix}
\end{equation}
The \textbf{conjugate} $A*$ of $A$ is the matrix
\begin{equation}
\begin{aligned}
(A^*)_{ij} = (A)_{ji}^*
\end{aligned}
\label{eq:conjugateMatrix}
\end{equation}
The \textbf{transposed conjugate} matrix $(A^\dagger)$ of $A$ is the matrix
\begin{equation}
\begin{aligned}
(A^\dagger) = (A^T)^*
\end{aligned}
\label{eq:transpodedConjugateMatrix}
\end{equation}
The complex conjugate of a transposed matrix is called its \textbf{Hermitian conjugate} and it is usually denoted by a dagger.
A matrix $A$ is called \textbf{unitary} if
\begin{equation}
\begin{aligned}
(A^\dagger) = A^{-1}
\end{aligned}
\label{eq:unitaryMatrix}
\end{equation}
where $A^{-1}$ is the inverse of $A$, that is $AA^{-1} = I$ (where $I$ is the identity matrix, $I = \begin{bmatrix}
1 & 0 \\
0 & 1 \\
\end{bmatrix}$).
\paragraph{Theorem} A linear function transforms a qubit into a qubit (that is, it preserves normalized vectors) if and only if it is unitary.
Back to our linear operator $\mathbf{M}$, we can now say that
\begin{equation*}
\langle B|\mathbf{M} = \langle B|\mathbf{M}^\dagger = (\beta_1^*, \ldots, \beta_n^*) \left(\begin{matrix}
m_{11}^* & m_{21}^* & m_{31}^* \\
m_{12}^* & m_{22}^* & m_{32}^* \\
m_{13}^* & m_{23}^* & m_{33}^* \\
\end{matrix}\right)
\end{equation*}
Thus, if
$$\mathbf{M}|A\rangle = |B\rangle$$
then
$$\langle A|\mathbf{M} = \langle B|$$
\paragraph{Conclusion} Real numbers play a special role in physics. The results of any measurements are real numbers: sometimes, we measure two quantities, put them together with an $i$ (forming a complex number), and call this number the result of a measurement. However, it’s actually just a way of combining two real measurements: if we want to be pedantic, we might say that observable quantities are equal to their own complex conjugates. That’s of course just a fancy way of saying they are real. We are going to find out very soon that quantum mechanical observables are represented by linear operators. What kind of linear operators? The kind that are the closest thing to a real operator. Observables in quantum mechanics are represented by linear operators that are equal to their own Hermitian conjugates \cite{susskind2014quantum}.
\subsection{Hermitian operator}
\paragraph{} In the section before we saw that an hermitian operator satisfy the property:
\begin{equation}
\mathbf{M} = \mathbf{M}^\dagger
\label{eq:hermitianOperator}
\end{equation}
In terms of matrix elements this can be say as
\begin{equation*}
m_{ji} = m_{ij}^*
\label{eq:hermitianOperatorMatrixElement}
\end{equation*}
Hermitian operators have some interesting properties
\paragraph{Property 1} The eigenvalues of an Hermitian operator are all real. It's easy to verify. Let be $\mathbf{L}$ an Hermitian operator, $\lambda$ an eigenvalue and $|\lambda\rangle$ the respective eigenvector. Thus,
$$\mathbf{L}|\lambda\rangle = \lambda|\lambda\rangle$$
And
$$\langle\lambda|\mathbf{L}^\dagger = \langle\lambda|\lambda^*$$
But $\mathbf{L} = \mathbf{L}^\dagger$. Thus,
$$\langle\lambda|\mathbf{L} = \langle\lambda|\lambda^*$$
Now, if with multiply both sides of the first condition by $\langle\lambda|$ and both sides of the latter by $|\lambda\rangle$, we obtain
$$\langle\lambda|\mathbf{L}|\lambda\rangle = \lambda\langle\lambda|\lambda\rangle$$
$$\langle\lambda|\mathbf{L}|\lambda\rangle = \lambda^*\langle\lambda|\lambda\rangle$$
This implies that $\lambda = \lambda^*$.
Hermitian operators are fundamental, because observable quantities in quantum mechanics are represented by them.
\paragraph{} We have to state three different fundamental properties:
\begin{enumerate}
\item The eigenvectors of a Hermitian operator are a complete set: this means that any vector the operator can generate as a result of its application can be expanded as a sum of its eigenvectors.
\item If $\lambda_1$ and $\lambda_2$ are two eigenvalues of a Hermitian operator and $\lambda_1 \neq \lambda_2$, then the corresponding eigenvectors are orthogonal.
\item Even if the two eigenvalues are equal the corresponding eigenvectors can be chosen to be orthogonal. This situation, in which two different eigenvectors have the same eigenvalue is called \textit{degeneracy}. This property comes into play when two operators have simultaneous eigenvectors.
\end{enumerate}
These three point can be summarized in the following theorem.
\paragraph{Theorem} The eigenvectors of a Hermitian operator form an orhonormal basis.
\paragraph{Proof of 1nd point} \from{Matteo}{Insert demonstration.}
\paragraph{Proof of 2nd point} Let be $\mathbf{L}$ a linear Hermitian operator. We can write
$$\mathbf{L}|\lambda_1\rangle = \lambda_1|\lambda_1\rangle$$
and
$$\mathbf{L}|\lambda_2\rangle = \lambda_2|\lambda_2\rangle$$
$\mathbf{L}$ is Hermitian, thus
$$\langle\lambda_1|\mathbf{L} = \lambda_1\langle\lambda_1|$$
and
$$\mathbf{L}|\lambda_2\rangle = \lambda_2|\lambda_2\rangle$$
Now, if with multiply both sides of the first condition by $\lambda_2\rangle|$ and both sides of the latter by $\langle\lambda_1|$, we obtain
$$\langle\lambda_1|\mathbf{L}|\lambda_2\rangle = \lambda_1\langle\lambda_1|\lambda_2\rangle$$
and
$$\langle\lambda_1|\mathbf{L}|\lambda_2\rangle = \lambda_2\langle\lambda_1|\lambda_2\rangle$$
Finally, if we subtract the second from the first, we obtain
$$(\lambda_2-\lambda_1) \langle\lambda_1|\lambda_2\rangle = 0$$
For the zero-product property, if $\lambda_2-\lambda_1 \neq 0$ than $\langle\lambda_1|\lambda_2\rangle = 0$ and this implies they are orthogonal. Q.E.D.
\paragraph{Proof of 3rd point} Even if $\lambda_1 = \lambda_2$, the two eigenvectors can be chosen to be orthogonal. Suppose,
$$\mathbf{L}|\lambda_1\rangle = \lambda_1|\lambda_1\rangle$$
and
$$\mathbf{L}|\lambda_2\rangle = \lambda_2|\lambda_2\rangle$$
In other words, there are two distinct eigenvectors with the same eigenvalue. It should be clear that any linear combination of the two eigenvectors is also an eigenvector with the same eigenvalue. With this much freedom, it is always possible to find two orthogonal linear combinations. Consider the arbitrary linear combination of these two eigenvectors:
$$|A\rangle = \alpha|\lambda_1\rangle + \beta|\lambda_2\rangle$$
Operating on both side with $\mathbf{L}$, we get:
$$\mathbf{L}|A\rangle = \alpha\mathbf{L}|\lambda_1\rangle + \beta\mathbf{L}|\lambda_2\rangle$$
Thus, because $\mathbf{L}|\lambda_1\rangle = \lambda_1|\lambda_1\rangle$ and $\mathbf{L}|\lambda_2\rangle = \lambda_2|\lambda_2\rangle$:
$$\mathbf{L}|A\rangle = \alpha\lambda|\lambda_1\rangle + \beta\lambda|\lambda_2\rangle$$
Thus,
$$\mathbf{L}|A\rangle = \lambda(\alpha|\lambda_1\rangle + \beta|\lambda_2\rangle) = \lambda|A\rangle$$
This equation demonstrates that any linear combination of $|\lambda_1\rangle$ and $|\lambda_2\rangle$ is also an eigenvector of $\mathbf{L}$, with the same eigenvalue. By assumption, these two vectors are linearly independent - otherwise, they would not represent distinct states. We will also suppose that they span the subspace of eigenvectors of $\mathbf{L}$ that have eigenvalue $\lambda$. There is a straightforward process, called the Gram-Schmidt procedure, for finding an orthonormal basis for a subspace, given a set of independent vectors that spans the subspace. In plain English, we can find two orthonormal eigenvectors by writing them as a linear combination of $|\lambda_1\rangle$ and $|\lambda_2\rangle$. We are talking about the Gram-Schmidt procedure introduced in \autoref{subpar:gramschmidt}.
% \subsection{Basic change}
% \paragraph{} The transition from one base to another is a linear transformation whose matrix is constructed as follows. Suppose that the vectors $|\psi_1\rangle$ and $|\psi_2\rangle$ form a basis for $\mathbb{C}^2$ and that in this basis it results $|0\rangle = b_{11}|\psi_1\rangle + b_{21}|\psi_2\rangle$ and $|1\rangle = b_{12}|\psi_1\rangle + b_{22}|\psi_2\rangle$. Then the base change matrix is given by:
% \begin{equation*}
% \begin{aligned}
% B = {\begin{bmatrix}
% b_{11} & b_{12} \\
% b_{21} & b_{22} \\
% \end{bmatrix}}
% \end{aligned}
% \end{equation*}
% The vector with representation $(\alpha, \beta)^T$ in the base $|0\rangle$ and $|1\rangle$, will have coordinates $B(\alpha,\beta)^T$ with respect to the base $|\psi_1\rangle$ and $|\psi_1\rangle$.
% \paragraph{Exercise} Look at exercises 10, 11 and 12 in \autoref{exs}.
% \subsection{Linear operators and external product}
% \paragraph{} A useful representation of a linear operator is that by an external product. Data $|v\rangle \in V$ and $|w\rangle \in V$, we define the linear operator $|w\rangle\langle v| : V \mapsto W$ associates to each vector $|v'\rangle \in V$ the vector in $W$ resulting from the scalar multiplication of $w$ for the internal product $\langle v|v'\rangle$, i.e.
% $$|w\rangle\langle v|(v')\rangle \equiv |w\rangle\langle v|(v')\rangle = \langle v|(v'\rangle|w\rangle$$
% Each orthonormal basis $\{|i\rangle\}$ for a vector space $V$ satisfies the completeness report:
% $$\sum\limits_{i}|i\rangle\langle i|$$
% In fact, for every $|v\rangle \in V, |v\rangle = \sum\nolimits_{i}v_i|i\rangle$,
% $$\left(\sum\limits_{i}|i\rangle\langle i|\right)|v\rangle = \sum\limits_{i}|i\rangle\langle i|v\rangle = \sum\limits_{i}v_i|i\rangle = |v\rangle$$
% because $\langle i|v\rangle = v_i$ for each $i$.
% Using the completeness report we obtain the following representation for linear operators which will be very useful in the following.
% Given a linear operator $L: V \rightarrow{} W$ and given the orthonormal basis $\{|v_i\rangle\}$ for $V$ and $\{|w_j\rangle\}$ for $W$, we can write $L$ as
% $$L = I_WLI_V$$
% where $I_V$ and $I_W$ are the identity in $V$ and in $W$ respectively. From this expression we obtain the representation as an external product of $L$. In fact
% $$I_WLI_V = \sum\limits_{ij}|w_j\rangle\langle w_j|L|v_i\rangle\langle v_i| = \sum\limits_{ij}\langle w_j|L|v_i\rangle|w_j\rangle\langle v_i|$$
% Note that the coefficients $\langle w_j|L|v_i\rangle$ correspond to the elements of the representation matrix of $L$ with respect to the input base $\{|v_i\rangle\}$ and to the output base $\{|w_j\rangle\}$. In particular, $L|v_i\rangle$ is the transformation of the $i$-th vector of the input basis into a vector in $W$ whose $j$-th coordinate is given by $\langle w_j|L|v_i\rangle$. This element is therefore the element of column $i$ and of row $j$ of the matrix for $L$.
% \subsection{Hermitian adjoint}
% \paragraph{} Given a linear operator $L$ over a Hilbert $V$ space, there is a single linear operator $L^{\dagger}$ such that for all vectors $|v\rangle, | w\rangle \in V$,
% $$(|v\rangle, L|w\rangle) = (L^{\rangle}|v\rangle, |w\rangle$$
% The operator $L^{\dagger}$ is called the \textbf{adjoint} of $L$. By convention, $|v\rangle^{\dagger} \equiv \langle v|$.
% From the definition follow the following properties:
% \begin{itemize}
% \item $(\sum\nolimits_{i}a_iL_i)^{\dagger} = \sum\nolimits_{i}a_i^*L_i^\dagger$
% \item $(L^\dagger)^\dagger = L$
% \end{itemize}
% In matrix representation, the adjoint operator corresponds to the conjugated transposed matrix of $L: L^\dagger = (L^*)^T$
% A \textbf{Hermitian operator} is an operator $L$ such that $L\dagger = L$. Projection operators are an important class of Hermitian operators, defined as follows. Given a vector space $V$ of dimension $d$, a subspace of $V$ of dimension $k$ is considered. Then, if ${|1\rangle, \ldots, |d\rangle}$ is an orthonormal basis for $V$, the subset ${|1\rangle, \ldots, |k\rangle}$ is an orthonormal basis for $W$. It is therefore defined
% $$P \equiv \sum\limits_{i=1}^{k}|i\rangle\langle i|$$
% sas the projection on the subspace $W$. The projection operators are idempotent: $P^2 = P$.
% Another important class of linear operators is that of normal operators. $L$ is normal if and only if $L^\dagger L = LL\dagger$. The spectral decomposition theorem establishes that an operator is normal if and only if it is diagonalizable, i.e. it can be written in the form $M = \sum\nolimits_{i} \lambda_i|i\rangle\langle i|$ where $\lambda_i$ are the eigenvalues of $M$ and $\{|i\rangle\}$ form an orthonormal basis for $V$.
% A Hermitian matrix is obviously normal.
% A normal matrix is Hermitian if and only if it has real eigenvalues.
% A matrix (or equivalently an operator) $U$ is said to be unitary if $U\dagger U = I$. The unit matrices have an important property, i.e. they preserve the internal products. In fact, if $U$ is unitary, then given two vectors $|v\rangle$ and $|w\rangle$
% $$(U|v\rangle, U|w\rangle) = \langle v|U^\dagger U|w\rangle = \langle v|I|w\rangle = \langle v|w\rangle$$
% From this result follows that the representation of a unit operator $U$ with respect to two orthonormal input and output bases $\{|v_i\rangle\}_i$ and $\{|w_i\rangle\}_i$ can be given in the form of external products such as
% $$U = \sum\limits_{i}|w_i\rangle\langle v_i|$$
\from{Matteo}{Review from the next to the end of section.}
\subsection{Tensor product}
\paragraph{} The tensor product is an operation that combines vector spaces to form larger vector spaces. The general construction for finite dimensional complex vector spaces is defined as follows. Note that for every positive integer $m$, the $m$-dimensional complex vector space ${\mathbb{C}}^m$ has as a standard basis
$$b_m^1, b_m^2, \ldots, b_m^m$$
where the column vector of dimension $m$, $b_m^j$, has all zero components and the $j_{th}$ which is $1$. So, each vector $u \in {\mathbb{C}}^m$ can be written as
$$\sum\limits_{j=1}^m{u_{j}b_{j}^m}$$
for $u_j \in \mathbb{C}$
\begin{equation*}
\begin{aligned}
{\begin{bmatrix}
u_1 \\
\vdots \\
u_j \\
\vdots \\
u_m \\
\end{bmatrix}}
\end{aligned}
\end{equation*}
Given two vector spaces ${\mathbb{C}}^k$ and ${\mathbb{C}}^l$, we define the tensor product as the function
$$\otimes: {\mathbb{C}}^k \times {\mathbb{C}}^l \xrightarrow{} {\mathbb{C}}^{kl}$$
with
\begin{equation*}
\begin{aligned}
v \otimes w = {\begin{bmatrix}
v_1w \\
\vdots \\
v_jw \\
\vdots \\
v_kw \\
\end{bmatrix}}
\end{aligned}
\end{equation*}
where for every $1 \leq j \leq k$, $v_jw$ is the multiplication of the column vector $w \in {\mathbb{C}}^l$ for the scalar $v_j \in \mathbb{C}$. By definition, the tensor product satisfies the following properties. Let be $z$ an arbitrary scalar in $\mathbb{C}$ and with $V$ and $W$ two generic Hilbert spaces of size $k$ and $l$ respectively.
\begin{enumerate}
\item $\forall \; \; |v\rangle \in V, |w\rangle \in W => z(|v\rangle \otimes |w\rangle) = (z|v\rangle) \otimes |w\rangle = |v\rangle \otimes (z|v\rangle)$
\item $\forall \; \; |v_1\rangle, |v_2\rangle \in V, |w\rangle \in W => (|v_1\rangle + |v_2\rangle) \otimes |w\rangle = |v_1\rangle \otimes |w\rangle + |v_2\rangle \otimes |w\rangle$
\item $\forall \; \; |v\rangle \in V, |w_1\rangle, |w_2\rangle \in W => |v\rangle \otimes (|w_1\rangle + |w_2\rangle) = |v\rangle \otimes |w_1\rangle + |v\rangle \otimes |w_2\rangle$
\end{enumerate}
\paragraph{Exercise} Look at exercises 3, 4, 5 in \autoref{exs}.
\subsubsection{Matrix tensor product}
\paragraph{} Given two linear operators with representation matrices
$$M: \mathbb{C}^k \mapsto \mathbb{C}^k, N: \mathbb{C}^l \mapsto \mathbb{C}^l$$
with respect to the standard bases of $C^k$ and $C^l$, the tensor product of $M$ and $N$ is the linear operator on $C^{kl}$ with representation matrix
$$M \otimes N: \mathbb{C}^{kl} \mapsto \mathbb{C}^{kl}$$
defined by
\begin{equation*}
\begin{aligned}
M \otimes N = {\begin{bmatrix}
M_{11}N & M_{12}N & \ldots & M_{1k}N \\
M_{21}N & M_{22}N & \ldots & M_{2k}N \\
\vdots & \vdots & \vdots & \vdots \\
M_{k1}N & M_{k2}N & \ldots & M_{kk}N \\
\end{bmatrix}}
\end{aligned}
\end{equation*}
where $M_{ij}$ is the element of indices $i$, $j$ of the matrix $M$ and $M_{ij}N$ is the matrix $l \times l$ obtained by multiplying $N$ by the complex number $M_{ij}$.
For instance, the tensor product between
\begin{equation*}
\begin{aligned}
M {\begin{bmatrix}
1 & 3 \\
0 & 1
\end{bmatrix}} \; \; \; and \; \; \;
N {\begin{bmatrix}
0 & 1 \\
-1 & 2
\end{bmatrix}}
\end{aligned}
\end{equation*}
is
\begin{equation*}
\begin{aligned}
M \otimes N = {\begin{bmatrix}
0 & 1 & 0 & 3 \\
-1 & 2 & -3 & 6 \\
0 & 0 & 0 & 1 \\
0 & 0 & -1 & 2
\end{bmatrix}}
\end{aligned}
\end{equation*}
\paragraph{Exercise} Look at exercises 6 in \autoref{exs}.
\newpage
\section{The spin operators}
\paragraph{} It may be hard to believe, but single spins - as simple as they are - still have a lot more to teach us about quantum mechanics, and we plan to milk them for all they're worth. The scope of this section is to write down the spin operators in concrete form, as $2\times 2$ matrices. Then, we'll get to see how they work in specific situations. These operators are the same that we'll be discussed in \autoref{sec:section5} as the \textit{quantum gates}. Before the dive into the details, I'd like to say a little more about how operators are related to physical measurements.
\paragraph{} As you know, physicists recognize various types of physical quantities, such as scalars and vectors. It should come as no surprise, then, that an operator associated with the measurement of a vector (such as spin) has a vector character of its own. In our travels so far, we have seen more than one kind of vector. The 3-vector is the most straightforward and serves as a prototype. It's a mathematical representation of an arrow in three-dimensional space, and is often represented by three real numbers, written out as a column matrix. Because their components are real-valued, 3-vectors are not quite rich enough to represent quantum states. For that, we need bras and kets, which have complex-valued components. What sort of vector is the spin operator $\sigma$? It is definitely not a state-vector (a bra or a ket). It's not exactly a 3-vector either, but it does have a strong family resemblance because it's associated with a direction in space. In fact, we will frequently use $\sigma$ as though it were a simple 3-vector. However, we'll try to keep things straight by calling $\sigma$ a \textit{3-vector operator}. What does that actually mean? In physical terms, it means this: just as a spin-measuring apparatus can only answer questions about a spin's orientation in a specific direction, a spin operator can only provide information about the spin component in a specific direction. To physically measure spin in a different direction, we need to rotate the apparatus to point in the new direction. The same idea applies to the spin operator - thus, if we want it to tell us about the spin component in a new direction, it too must be ``rotated", but this kind of rotation is accomplished mathematically. The bottom line is that there is a spin operator for each direction in which the apparatus can be oriented.
\subsection{Building the spin operators}
\paragraph{} The goal is to construct operators to represent the components of spin, $\sigma_x$, $\sigma_y$, and $\sigma_z$. Then we'll build on those results to construct an operator that represents a spin component in any direction. As usual, we begin with $\sigma_z$.
\subsubsection{Deriving z operators from principles}
\paragraph{} We know that $\sigma_z$ has definite, unambiguous values for the states $|u\rangle = |0\rangle = \binom{1}{0}$ and $|d\rangle = |1\rangle = \binom{0}{1}$, and that the corresponding measurement values are $\sigma_z = +1$ and $\sigma_z = -1$. Here is what the first three principles tell us:
\begin{enumerate}
\item Principle 1: Each component of $\sigma$ is represented by a linear operator;
\item Principle 2: The eigenvectors of $\sigma_z$ are $|u\rangle$ and $|d\rangle$. The corresponding eigenvalues are +1 and -1. We can express this with the abstract equations:
$$\sigma_z|u\rangle = |u\rangle$$
$$\sigma_z|d\rangle = -|d\rangle$$
\item Principle 3: States $|u\rangle$ and $|d\rangle$ are orthogonal to each other. This can be expressed as $\langle u|d\rangle = 0$
\end{enumerate}
Thus, consider the \textit{matrix form} of $\sigma_z$, from the second point we can say that
\begin{equation*}
\left(\begin{matrix}
(\sigma_z)_{11} & (\sigma_z)_{12} \\
(\sigma_z)_{21} & (\sigma_z)_{22} \\
\end{matrix}\right) \binom{1}{0} = \binom{1}{0}
\end{equation*}
\begin{equation*}
\left(\begin{matrix}
(\sigma_z)_{11} & (\sigma_z)_{12} \\
(\sigma_z)_{21} & (\sigma_z)_{22} \\
\end{matrix}\right) \binom{0}{1} = -\binom{0}{1}
\end{equation*}
The only matrix that satisfy this two equations is
\begin{equation*}
\sigma_z = \left(\begin{matrix}
(\sigma_z)_{11} & (\sigma_z)_{12} \\
(\sigma_z)_{21} & (\sigma_z)_{22} \\
\end{matrix}\right) = \left(\begin{matrix}
1 & 0 \\
0 & -1 \\
\end{matrix}\right)
\end{equation*}
This is our very first example of a quantum mechanical operator. Let's summarize what went into it. First, some experimental data: there are certain states that we called $|u\rangle$ and $|d\rangle$, in which the measurement of $\sigma_{z}$ gives unambiguous results $\pm 1$. Next, the principles told us that $|u\rangle$ and $|d\rangle$ are orthogonal and are eigenvectors of a linear operator $\sigma_{z}$. Finally, we learned from the principles that the corresponding eigenvalues are the observed (or measured) values, again $\pm 1$.
\subsubsection{Deriving x operators from principles}