<jupyter_start><jupyter_text>prepared by <NAME> (QLatvia)                 This cell contains some macros. If there is a problem with displaying mathematical formulas, please run this cell to load these macros. $ \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}}} $  Operators on Multiple Bits[Watch Lecture](https://youtu.be/vd21d1KTC5c) We explain how to construct the operator of a composition system when we apply an operator to one bit or to a few bits of the composite system.*Here we have a simple rule, we assume that the identity operator is applied on the rest of the bits.*  Single bit operators When we have two bits, then our system has four states and any operator of the system can be defined as a $ (4 \times 4) $-dimensional matrix.For example, if we apply the probabilistic operator $ M =  \mymatrix{c}{ 0.3 & 0.6 \\ 0.7 & 0.4  } $ to the second bit, then how can we represent the corresponding $ (4 \times 4) $-dimensional matrix?The answer is easy. By assuming that the identity operator is applied to the first bit, the matrix is$$ I \otimes M = \I \otimes  \mymatrix{c}{ 0.3 & 0.6 \\ 0.7 & 0.4  } = \mymatrix{cccc} { 0.3 & 0.6 & 0 & 0 \\ 0.7 & 0.4 & 0 & 0 \\ 0 & 0 & 0.3 & 0.6 \\ 0 & 0& 0.7 & 0.4 }.   $$  Task 1We have two bits. What is $ (4 \times 4) $-dimensional matrix representation of the probabilistic operator $ M =  \mymatrix{c}{ 0.2 & 0.7 \\ 0.8 & 0.3  } $ applied to the first bit? click for our solution  Task 2We have three bits. What is $ (8 \times 8) $-dimensional matrix representation of the probabilistic operator $ M =  \mymatrix{c}{ 0.9 & 0.4 \\ 0.1 & 0.6  } $ applied to the second bit? click for our solution  Two bits operators We start with an easy example. We have three bits and we apply the probabilistic operator $ M = \mymatrix{rrrr}{0.05 & 0 & 0.70 & 0.60 \\ 0.45 & 0.50 & 0.20 & 0.25 \\ 0.20 & 0.35 & 0.10 & 0 \\ 0.30 & 0.15 & 0 & 0.15 } $ to the first and second bits. Then, the corresponding $ (8 \times 8) $-dimensional matrix is $ M \otimes I $, where $I$ is the $(2 \times 2)$-dimensional Identity matrix.If $ M $ is applied to the second and third bits, then the corresponding matrix is $ I \otimes M $. **What if $ M $ is applied to the first and third bits?**We pick an example transition: it is given in $ M $ that $ \greenbit{0} \brownbit{1}  \xrightarrow{0.35} \greenbit{1} \brownbit{0}  $.  - That is, when the first bit is 0 and third bit is 1, the first bit is set to 1 and the the third bit is set to 0 with probability 0.35:$$ \myarray{ccccc}{\mbox{first-bit} & \mbox{third-bit} & probability & \mbox{first-bit} & \mbox{third-bit} \\ \greenbit{0} & \brownbit{1} & \xrightarrow{0.35} & \greenbit{1} & \brownbit{0} }  $$- We put the second bit in the picture by assuming that the identity operator is applied to it:$$ \myarray{ccccccc}{\mbox{first-bit} & \mbox{second-bit} & \mbox{third-bit} & probability & \mbox{first-bit} & \mbox{second-bit} & \mbox{third-bit} \\ \greenbit{0} & \bluebit{0} & \brownbit{1} & \xrightarrow{0.35} & \greenbit{1} & \bluebit{0} & \brownbit{0}  \\\greenbit{0} & \bluebit{1} & \brownbit{1} & \xrightarrow{0.35} & \greenbit{1} & \bluebit{1} & \brownbit{0} \\\\ \hline \\\greenbit{0} & \bluebit{0} & \brownbit{1} & \xrightarrow{0} & \greenbit{1} & \bluebit{1} & \brownbit{0}  \\\greenbit{0} & \bluebit{1} & \brownbit{1} & \xrightarrow{0} & \greenbit{1} & \bluebit{0} & \brownbit{0}}$$  Task 3Why are the last two transition probabilities zeros in the above table?  Task 4We have three bits and the  probabilistic operator $ M = \mymatrix{rrrr}{0.05 & 0 & 0.70 & 0.60 \\ 0.45 & 0.50 & 0.20 & 0.25 \\ 0.20 & 0.35 & 0.10 & 0 \\ 0.30 & 0.15 & 0 & 0.15 } $ is applied to the first and third bits. What is the corresponding the $(8 \times 8)$-dimensional matrix applied to the whole system?*You may solve this task by using python.*<jupyter_code># the given matrix
M = [
    [0.05, 0, 0.70, 0.60],
    [0.45, 0.50, 0.20, 0.25],
    [0.20, 0.35, 0.10, 0],
    [0.30, 0.15, 0, 0.15]
]

# 
# you may enumarate the columns and rows by the strings '00', '01', '10', and '11'
# int('011',2) returns the decimal value of the binary string '011'
#

#
# your solution is here
#<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.20118343195266272, 'fraction_numerical': 0.06377383300460224, 'mean_word_length': 3.39033189033189, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, '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': '25949', 'license': 'Apache-2.0', 'n_tokens_mistral': 2404, 'n_tokens_neox': 2137, 'n_words': 681, 'path': 'bronze/B19_Operators_on_Multiple_Bits.ipynb', 'repo_name': 'QPoland/basics-of-quantum-computing-pl', 'size': '6096'}