# Introduction to quantum computing **Quantum computing** is a theory of programming a quantum computer. If you're reading this article, you're likely curious about quantum computing and would like to learn more. How does a quantum computer work? What makes it different from a classical computer? How exactly do you program it? If you don't have a background in physics quantum computing may initially seem math-heavy and rather difficult to understand. An assumption I'm going to make is that the reader has no exposure to quantum physics. But I'd like to draw comparisons between a quantum and a classical computers throughout the article. So, I'm also going to make an assumption the reader is at least a computer programmer. Before venturing on a journey into quantum computing let's definitively answer the question *"What maths do I need to know to start learning quantum computing?"*. You will need to know vectors, matrices and complex numbers. Those comprise 90% of theory quantum computing. If you don't have a good command of linear algebra over complex numbers, understanding any amount quantum computing is going to be impossible. To test your knowledge, see if you can recognize the following notation. If you can, you're likely well-equiped to dive into quantum computing. If not, read the prerequisites in the next section for a refresher! $$1 + 2i\qquad 3e^{\frac{\pi}{4}}\qquad \begin{pmatrix}1\\0\end{pmatrix}\qquad \begin{pmatrix}0 & 1\\ 1 & 0\end{pmatrix}\qquad\text{You need to know this!}$$ Let's also answer the dual question *What maths do I not need to know for quantum computing?*. For starters, you do not need to know any probability theory. This may come as not only surprising, but shocking. Isn't quantum mechanics all about probabilities? Dead-and-alive cats, particles going through both slits etc.? Indeed, probabilities appear when you measure a quantum state. When you measure a quantum state nature gives a probabilistic answer. But probabilities play no role in programming a quantum computer -- they only play a role in measurement. And even after measurement, you do a state vector update and continue to use linear algebra. In fact, you'll be surprised how little of probability theory in used in quantum computing. For sure, you won't see any mention of $\sigma$-algebras, moments, CDFs, PDFs, chi squared test etc. $$P(A|B) = \frac{P(B|A)P(A)}{P(B)}\qquad\text{You won't need this}$$ Another part of mathematics you won't need is calculus (derivates, integrals, differential equations ...). This may also come as equally shocking, if not more so. Don't quantum systems obey the Schrodinger equation, which is a differential equation? That is also true! Physical qubits that Google and IBM create in their dilution refrigerators do obey the Schrodinger equation. Similarily, classical bits in Intel or AMD CPU registers rely on electric fields, which obey the Maxwell's equations. But you do not to know Maxwell's equations to do classical computing. In a similar way, you don't to know the Schrodinger equation to do quantum computing. $$i\hbar\frac{\partial}{\partial t}\lvert\psi\rangle = H\lvert\psi\rangle\qquad\text{You won't need this}$$ At this point perhaps at you might be asking yourself *"What about quantum computing is even quantum?"* Is quantum computing completely detached from quantum mechanics? No! In fact qubits are one of the simplest quantum mechanical systems. Once you understand qubits, you are poised. ## Prerequisites ### Complex numbers What are real numbers $\mathbb{R}$? Real numbers lie on a 1D number line. Adding and multiplying numbers is another number. Addition is associative, meaning (2 + 3) + 4 gives the same answer as 2 + (3 + 4), and so is multiplication. Addition is commutative, meaning 2 + 3 gives the same answer as 3 + 2, and so is multiplication. Number 0 does nothing in addition e.g. 0 + 5 = 5. Number 1 does nothing in multiplication e.g. 1 * 5 = 5. Multiplication is distributive over addition meaning 2 * (3 + 4) gives the same answer as 2 * 3 + 2 * 4. What are complex numbers $\mathbb{C}$? Complex numbers are, in essence, 2D numbers. Adding and multiplying complex numbers is another complex number. Complex multiplication is associative meaning, $((1 + i)(2 + 2i))(3 + 3i) = (1 + i)((2 + 2i)(3 + 3i))$ and so is addition. Complex multiplication is commutative, meaning $(1 + i)(2 + 2i) = (2 + 2i)(1 + i)$ and so is addition. Complex number $0 + 0i$ does nothing in addition. Complex number $1 + 0i$ does nothing in multiplication. Complex multiplication is distributive over addition meaning $(1 + i)((2 + 2i) + (3 + 3i)) = (1 + i)(2 + i) + (1 + i)(3 + 3i)$. All these rules -- closure, associativity, commutativity, 0 existence, 1 existence and distributivity of multiplication over addition -- define something specific. An algebraic "field". A field is a structure in abstract algebra that captures the familiar notion of what a number is. Both $\mathbb{R}$ and $\mathbb{C}$ satisfy field axioms. Meaning, complex numbers work in exactly the same way real numbers do. All algebraic intuition you may have when dealing real numbers applies to complex numbers too. If both complex numbers and real numbers work the same way, why use complex numbers? ### Vector space What is a vector? Conceptually, a vector is something that can be added (by another vector) and scaled (by some number).