Suppose I have a quantum gate $U$ and it's a controlled gate. In particular, I have a $2\times 2$ matrix formulation of the gate's action on 2 adjacent qubits.
How can I make this work on an $n$-bit system?
To explain precisely what I mean, if I wanted to implement a controlled $U$ gate on a 3 qubit system where the first 2 bits have the $U$ acting on them and the third qubit is kept the same, I would get the corresponding matrix by working out $U\otimes I$. However, I could not do any similar product to get the gate on 3 qubits in which the first bit is "controlled", the second bit is kept the same and the third bit has $U$ acting on it.
So how do I make the matrix which allows me to "control" the $m$th bit and use $U$ conditionally on the $n$th bit out of a bunch of $k$ qubits?