<jupyter_start><jupyter_text>$ \newcommand{\bra}[1]{\langle 1|} $$ \newcommand{\ket}[1]{|1\rangle} $$ \newcommand{\braket}[2]{\langle 1|2\rangle} $$ \newcommand{\dot}[2]{ 1 \cdot 2} $$ \newcommand{\biginner}[2]{\left\langle 1,2\right\rangle} $$ \newcommand{\mymatrix}[2]{\left( \begin{array}{1} 2\end{array} \right)} $$ \newcommand{\myvector}[1]{\mymatrix{c}{1}} $$ \newcommand{\myrvector}[1]{\mymatrix{r}{1}} $$ \newcommand{\mypar}[1]{\left( 1 \right)} $$ \newcommand{\mybigpar}[1]{ \Big( 1 \Big)} $$ \newcommand{\sqrttwo}{\frac{1}{\sqrt{2}}} $$ \newcommand{\dsqrttwo}{\dfrac{1}{\sqrt{2}}} $$ \newcommand{\onehalf}{\frac{1}{2}} $$ \newcommand{\donehalf}{\dfrac{1}{2}} $$ \newcommand{\hadamard}{ \mymatrix{rr}{ \sqrttwo & \sqrttwo \\ \sqrttwo & -\sqrttwo }} $$ \newcommand{\vzero}{\myvector{1\\0}} $$ \newcommand{\vone}{\myvector{0\\1}} $$ \newcommand{\stateplus}{\myvector{ \sqrttwo \\  \sqrttwo } } $$ \newcommand{\stateminus}{ \myrvector{ \sqrttwo \\ -\sqrttwo } } $$ \newcommand{\myarray}[2]{ \begin{array}{1}2\end{array}} $$ \newcommand{\X}{ \mymatrix{cc}{0 & 1 \\ 1 & 0}  } $$ \newcommand{\I}{ \mymatrix{rr}{1 & 0 \\ 0 & 1}  } $$ \newcommand{\Z}{ \mymatrix{rr}{1 & 0 \\ 0 & -1}  } $$ \newcommand{\Htwo}{ \mymatrix{rrrr}{ \frac{1}{2} & \frac{1}{2} & \frac{1}{2} & \frac{1}{2} \\ \frac{1}{2} & -\frac{1}{2} & \frac{1}{2} & -\frac{1}{2} \\ \frac{1}{2} & \frac{1}{2} & -\frac{1}{2} & -\frac{1}{2} \\ \frac{1}{2} & -\frac{1}{2} & -\frac{1}{2} & \frac{1}{2} } } $$ \newcommand{\CNOT}{ \mymatrix{cccc}{1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0} } $$ \newcommand{\norm}[1]{ \left\lVert 1 \right\rVert } $$ \newcommand{\pstate}[1]{ \lceil \mspace{-1mu} 1 \mspace{-1.5mu} \rfloor } $$ \newcommand{\greenbit}[1] {\mathbf{{\color{green}1}}} $$ \newcommand{\bluebit}[1] {\mathbf{{\color{blue}1}}} $$ \newcommand{\redbit}[1] {\mathbf{{\color{red}1}}} $$ \newcommand{\brownbit}[1] {\mathbf{{\color{brown}1}}} $$ \newcommand{\blackbit}[1] {\mathbf{{\color{black}1}}} $  One Qubit _prepared by <NAME>_[](https://youtu.be/MTsgLSrTNbY) _Quantum systems are linear systems: "The quantum states are represented by vectors and quantum operators are represented by matrices. The new quantum states are calculated by corresponding matrix-vector multiplications."_A qubit (quantum bit) has two states: state 0 and state 1.They are denoted by ket-notation:$ \ket{0} = \myvector{1 \\ 0} $ and $ \ket{1} = \myvector{0\\ 1} $.  NOT operator NOT operator flips the value of a qubit.We use capital letter for the matrix form of the operators:$ X = \X$. The action of $ X $ on the qubit:$ X \ket{0} = \ket{1} $. More explicitly, $ X \ket{0} = \X \vzero = \vone = \ket{1} $.Similarly, $ X \ket{1} = \ket{0} $.More explicitly, $ X \ket{1} = \X \vone = \vzero = \ket{0} $. Why is the NOT operator referred to as the x-gate?   In Bronze, we use only real numbers, but we should note that complex numbers are also used in quantum computing. When complex numbers are used, the state of a qubit can be represented by a four dimensional real number valued vector, which is not possible to visualize. On the other hand, it is possible to represent such state in three dimensions (with real numbers). This representation is called [Bloch sphere](https://en.wikipedia.org/wiki/Bloch_sphere).In three dimensions, we have axes: x, y, and z. X refers to the rotation with respect to x-axis. Similarly, we have the rotation with respect to y-axis and z-axis. In Bronze, we will also see the operator Z (z-gate). The operator Y is defined with complex numbers.  Hadamard operatorHadamard operator ($ H $ or h-gate) looks similar to a fair coin-flipping.$$    H = \hadamard.$$But, there are certain dissimilarities:     we have a negative entry, and     instead of $ \frac{1}{2} $, we have its square root $ \mypar{ \frac{1}{\sqrt{2}} } $.  Quantum systems can have negative transitions.  Can probabilistic systems be extended with negative values?   One-step HadamardStart in $ \ket{0} $.After applying $ H $:$$  H \ket{0} =  \hadamard \vzero =  \stateplus.$$After measurement, we observe the states $ \ket{0} $ and $ \ket{1} $ with equal probability $ \frac{1}{2} $. How can this be possible when their values are $ \frac{1}{\sqrt{2}} $?  Let's start in $ \ket{1} $.After applying $ H $:$$    H \ket{1} = \hadamard \vone = \stateminus.$$After measurement, we observe the states $ \ket{0} $ and $ \ket{1} $ with equal probability $ \frac{1}{2} $. We obtain the same values even when one of the values is negative.   The absolute value of a negative value is positive.The square of a negative value is also positive.As we have observed, the second fact fits better when reading the measurement results. When a quantum system is measured, the probability of observing one state is the square of its value [*].The value of the system being in a state is called its amplitude.In the above example, the amplitudes of states $\ket{0}$ and $ \ket{1} $ are respectively $ \sqrttwo $ and $ -\sqrttwo $.The probabilities of observing them after a measurement are $ \onehalf $._Remark that, after observing state $ 0 $, the new state will be $ \ket{0} $, and, after observing state $ 1 $, the new state will be $ \ket{1} $.__[*] the square of its magnitude value when using complex numbers_  States $ \ket{+} $ and $ \ket{-} $ In the literature, the quantum states obtained after applying $ H $ to $ \ket{0} $ and $ \ket{1} $ are known as **ket-plus** ($\ket{+}$) and **ket-minus** ($ \ket{-} $) states, respectively:$ \ket{+} = H \ket{0} = \hadamard \vzero = \stateplus $$ \ket{-} = H \ket{1} =  \hadamard \vone = \stateminus $  Task 1 What are the probabilities of observing the states  $ \ket{0} $ and $ \ket{1} $ if the system is in $ \myvector{-\frac{3}{5} \\ - \frac{4}{5}} $ or $ \myrvector{\frac{3}{5} \\ -\frac{4}{5}} $ or $ \myrvector{\frac{1}{\sqrt{3}} \\ - \frac{\sqrt{2}}{\sqrt{3}}} $?<jupyter_code>#
# your solution is here
#

from numpy import *
v1 = array([-3.0/5 , -4/5])
v2 = array([1.0/3 **(0.5) , -2**(0.5)/3**(0.5)])
v3 = array([3.0/5 , 4/5])

print(v1*v1)
print(v3*v3)
print(v2*v2)<jupyter_output>[0.36 0.64]
[0.36 0.64]
[0.33333333 0.66666667]
{'fraction_non_alphanumeric': 0.19589308996088656, 'fraction_numerical': 0.03829856584093872, 'mean_word_length': 3.7907884465261517, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '41080', 'license': 'Apache-2.0', 'n_tokens_mistral': 2186, 'n_tokens_neox': 2035, 'n_words': 681, 'path': 'quantum-with-qiskit/Q24_One_Qubit.ipynb', 'repo_name': 'Ainiall/quantum', 'size': '6148'}