|"+"> and |"-"> are, just as |"0"> and |"1"> are, in some sense opposites. Even their names, |"+"> and |"-"> , help us remember that they are opposites and that they can be grouped together as a basis. They defined in words/algebra as follows:
and
We'll define these in code:
plus_qubit=1/sqrt(2)*np.matrix('1; 1')
minus_qubit=1/sqrt(2)*np.matrix('1; -1')
We can use them in our new qubit function to obtain qubits between |"+"> and |"-">. For example, qubit(50,50,plus_qubit,minus_qubit) or qubit(10,90,plus_qubit,minus_qubit) are used to get qubits between these two opposites.
This basis is also described as the x basis or the diagonal basis. In the next section, we'll go over visualizing these states on a sphere, and see that |"+"> and |"-"> lie on the x axis of the sphere. This is where the name x basis comes from.