I am having difficulties with the calculations of qubits. I think I can do them, but it feels so massivly inefficient!
In this tutorial grover's algorithm for example, there's a simple oracle given for the binary bitcombination '110': (bit-order is as usual swapped, so most significant bit is q2 - at least I think so)
what I've tried so far:
let $a = |110\rangle$
the first step I thought would be to apply the $X$ on the top bit and the Hadamard on the bottom bit so:
$a' = |111\rangle$
$a'' = \frac{1}{\sqrt{2}}(|011\rangle - |111\rangle)$
next I would think: only when the second and third bit are equal to 1 then the first bit swaps:
$a''' = \frac{1}{\sqrt{2}}(|111\rangle - |011\rangle)$
next I negate the top (third) bit:
$a^{4'} = \frac{1}{\sqrt{2}}(|110\rangle - |010\rangle)$
and finally I use Hadamard on the bottom (first) bit:
$\displaystyle a^{5'} = \frac{1}{2} \Big(|010\rangle - |110\rangle -\big(|010\rangle + |110\rangle\big)\Big)$
$= -|110\rangle$
and yes, thats exactly what I want. But is there a way to calculate this alternively with some matrices or tensors? where I can use the form of
$ |110\rangle = \begin{pmatrix} 0\\0\\0\\0\\0\\0\\1\\0 \end{pmatrix}$
How can I represent the layer with $X$ and $H$ mixed?