I am trying to understand how CNOT or X gate can be explained by even more basic gates.
I went through these 2 links that explained the relation, but for my understanding, I am trying to prove it by matrix form. And yes I am clearly disabled in mathematics.
So, let's take the case where first Qbit(Q1) is the control and the second Qbit(Q2) is the target.
As per the articles, CNOT can be explained by $(I\times H)\cdot Z\cdot(I\times H)$. where X is matrix multiplication and (.) refers to dot product.
So, I went on to first convert all of them to the matrix Step 1:
$\left(\begin{bmatrix}1 & 0\\0 & 1\end{bmatrix}\times{1\over\sqrt2}\begin{bmatrix}1 & 1\\1 & -1\end{bmatrix}\right)\cdot\begin{bmatrix}1 & 0\\0 & -1\end{bmatrix}\cdot\left(\begin{bmatrix}1 & 0\\0 & 1\end{bmatrix}\times{1\over\sqrt2}\begin{bmatrix}1 & 1\\1 & -1\end{bmatrix}\right)$
I have my doubts if this understanding itself is correct but let's continue hoping it is.
Step 2: $\left({1\over\sqrt2}\begin{bmatrix}1 & 1 & 0 & 0\\1 & -1 & 0 & 0\\0 & 0 & 1 & 1\\0 & 0 & 1 & -1 \end{bmatrix}\right)\cdot\begin{bmatrix}1 & 0\\0 & -1\end{bmatrix}\cdot\left({1\over\sqrt2}\begin{bmatrix}1 & 1 & 0 & 0\\1 & -1 & 0 & 0\\0 & 0 & 1 & 1\\0 & 0 & 1 & -1 \end{bmatrix}\right)$
Does this approach look right? if so, how should I approach further? if not what am I missing?
I even tried to take a smaller bit to solve and tried to solve this:
$X = H\cdot Z \cdot H$
Step 1: $X = {1\over\sqrt2}\begin{bmatrix}1 & 1\\1 & -1\end{bmatrix}\cdot \begin{bmatrix}1 & 0\\0 & -1\end{bmatrix} \cdot {1\over\sqrt2}\begin{bmatrix}1 & 1\\1 & -1\end{bmatrix}$
Step 2: $X = {1\over2}\begin{bmatrix} 1*1 & 1*0 \\ 1*0 & -1*-1\end{bmatrix}\cdot \begin{bmatrix}1 & 1 \\ 1 & -1\end{bmatrix}$
Step 3: $X = {1\over2}\begin{bmatrix} 1 & 0 \\ 0 & 1\end{bmatrix}\cdot \begin{bmatrix}1 & 1 \\ 1 & -1\end{bmatrix}$
Step 4: $X = {1\over2}\begin{bmatrix} 1*1 & 0*1 \\ 0*1 & 1*-1\end{bmatrix}$
Step 5: $X = {1\over2}\begin{bmatrix} 1 & 0 \\ 0 & -1\end{bmatrix}$
once again, this is not Pauli-X gate, so I must be doing something stupid. Please help and guide me.