So now we are ready to look at our first quantum circuit. So, how does a quantum circuit work? Quantum circuit consists of wires and gates. It's just like a classical circuit except that the gates are now quantum gates and the wires carry bits of information. The one other property of quantum circuits is every gate has the same number of wires leaving it as the number that enter it, okay. Let's make up a circuit that consists of two gates, the Hadamard Gate and the CNOT Gate. So remember what the Hadamard Gate does? What it does is. H(0) =,, + and H(1) =,, -. In fact H(+) = (zero) and H(-1) = (one) as well. So it swaps zero and +, swaps one and -. So it's a one qubit gate. Okay, so now what we want to understand is what's the behavior of the simple quantum circuit where you first perform a Hadamart on the first qubit. And then you perform a CNOT with the first qubit as the source as the, as the control bit and the second qubit as a target bit. So let's try to understand what happens if the input bits are both zero. So, let's follow, follow the state as we go along. So initially, the state is 00 but then what happens after the, after this first Hadamard? Well the first qubit now is in the state one / square root two (zero) + one / square root two (one). And the second qubit is still in the state zero. So the state here is one / square root to (00) + one / square root two (ten). Okay so now, this is the input state to the CNOT Gate. So what happens after we go through this CNOT Gate? Well, okay, so you want to understand what the state is here. What is the CNOT Gate do to (00)? Well, the control bit is zero so you end up with one / square root two (00). What about (ten)? Well now the control bit is one and so the target bit gets split so you end up in the state one / square root two (eleven). I hope you'll recognize this state. This is a Bell State. Okay so, here is a circuit that starts with two qubits initially in the zero state and what it does is it entangles them into a Bell State. Okay now, here's the interesting thing. If you play with the circuit you realize that as y ou change he inputs from 00 to the four possibility, the other three possibilities 01, ten, and eleven. The output state changes between this, whats called this five plus state which was, which was what the, what we were calling the Bell State but in fact there is a whole basis of Bell States. There are four orthogonal Bell States. These are called the Bell Basis States and they look like this. They, they come in pairs. There's phi+ and phi-. Phi+ is 00 + eleven. Phi- is 00 - eleven. Of course, with this normalization, one / square root two. And then you have psi+ and psi- which are 01 + ten and 01 - ten. Okay, so you should check that these are four mutually orthogonal basis states. They are, they are mutually orthogonal unit vectors. And you should also check that as you change the input bits. Say from 00 to, should we do one more example. Let's say, what happens if you start with ten? So suppose, suppose that you start with ten. Now, what's the output look like? Well, so at this point we'll be in the state (one / square root two (zero) - one / square root two (one)) (ten) which is. One / square root two (00) - one / square root two (ten). And now when we feed this through this CNOT Gate and we are looking at the state here. This, the first part goes to just (00). The second part, the control bit is one, so we get (eleven) which is exactly this one, okay. So check that you understand what happens in the case you have 01 and then eleven as inputs? Okay, so now let's look at one other aspect of this. Remember that we said the CNOT is its own inverse, Hadamard is its own inverse so now, let's think about it this way. Let's think the input bits as coming in from this side and the output bits coming out on, on the left. Here. Okay, so instead of the circuit being one where you first do a Hadamard on the first qubit and then do a CNOT, what if you, first the CNOT and then the Hadamard. Okay. So, so just for convenience let me think of the circuit as running from right to left. Okay but, but remember, we could have done exactly the same thing where we flip the circuit arou nd. So we, we put the, the CNOT first on the left, then the Hadamard and then we put the inputs on the left and the output on the right, it's all the same thing. But for that in a mess, what I'm going to do is I'm going to now think of the input is coming in from the right and I'll keep the circuit the way it was. Except as I think of, think of the bits as moving from right to left. Okay. So what happens? So lets, lets hear that we feed in the Bell State (00) + (eleven) We want to know what's the output going to be? What happens? What, what would the state be out here? Well I claim it's exactly what it was, you know so when we started from 00 and this, ran the circuit forward the state out here was one / square root two (00) + one / square root two (ten). And then, when we ran this forward, this, this state got transformed into the Bell State after going through the CNOT. Well, what happens if we apply CNOT again to this state? I plainly come back to where we started from because you apply the CNOT twice, you come back to where you started from. Okay, so when we move from right to left here, we are just retracing our path. Same goes for the Hadamard. When we apply the Hadamard to this state we retrace our path and we come back to 00. Okay? So, so here's the, here's the picture you should have. If you start with the state 00, you apply this circuit to it, it entangles the qubits and creates this Bell State. If you start from ten, it entangles it and creates this, this other Bell State phi-. And similarly for (01), (eleven) creates this two states. But now you can also run the circuit backwards from right to left. And now, if you feed in a Bell State on this side, on the right side what the circuit does for you as you run it from right to left is it analyzes the Bell State for you. And outputs (00), (01), etcetera which tells you which Bell State it was. Okay, what does this mean? So suppose that I, I were to tell you I have these two qubits. They are in one of the four Bell States, one of these four Bell States, psi+, phi+, psi-, phi- but I don't know which one. Can you please help me figure out which one it's in? This is what you would do. You would, you would create the circuit. And it created, you know to look like this you, you know, at first does a CNOT and then does a Hadamard. And now, what this, what this circuit does for you is, is it analyzes Bell States. What that means is after you run the circuit, if you just measure these two qubits in the standard basis. If you get as output 00 you knew that the Bell State was phi+, it was (00) + (eleven). If you get (ten) you know it was phi-, (00) - (eleven), etcetera. So this is what's called a Bell Basis Measurement Circuit