# Transformation matrix for a two-qubit operation where there are more than two qubits

I have an OPENQASM program that performs entanglement swapping. It has five qubits: the data qubit and four link qubits. It works, but I want to see the details of the Bell measurement transformation. So what I am looking for is a reference or technique that will help me construct the 32 by 32 matrix from the four-by-for matrix for the Bell measurement basis. I understand that this is written as a direct product or tensor product, but I don't know what that means in terms of matrix operations.

Something like $$B \otimes I$$? Again, what does this mean?

Of course, the general problem is, given an $$n$$-qubit unitary transformation, how to construct the $$m$$-qubit matrix where $$m>n$$?

Parallel composition of operator $$A$$ acting on subsystem $$a$$ and operator $$B$$ acting on subsystem $$b$$ is the tensor product $$A\otimes B$$ on the joint system $$ab$$. In particular, parallel composition of $$A$$ on $$a$$ and identity on $$b$$ is indeed $$A\otimes I$$ as anticipated in the question. This applies to unitary gates, measurement operators, pairs of Kraus operators etc.
We can compute the matrix of operator $$A\otimes B$$ using Kronecker product
$$A\otimes B=\begin{bmatrix}a_{11}B&\dots&a_{1n}B\\&\dots&\\a_{n1}B&\dots&a_{nn}B\end{bmatrix}$$
of matrix $$A$$ with matrix $$B$$. Note that if $$A$$ is $$n\times n$$ and $$B$$ is $$m\times m$$ then $$A\otimes B$$ is $$nm\times nm$$.