permutation matrix, we find that the output is no longer a function of the inputs and *continuous* weights, but rather of the inputs and a *discrete set* of permutation matrices. However, in the generalisation to unitaries, for a gate with $n$ inputs and outputs, there exist an infinite number of unitaries, in contrast with the discrete set of permutation matrices. This means that the unitaries can be parametrised by continuous variables, which once again allows the application of gradient descent.

Given that any unitary matrix $U$ can be expressed as $U=e^{iH}$, where $H$ is a Hermitian matrix [@NielsenChuang00], and that such matrices can be written as linear combinations of tensor products of the Pauli matrices and the identity, it follows that a general $N$-qubit unitary can be expressed as $$\label{eq:u_n}
U_{N} \! = \! \exp \! \Bigg[ \! i \Bigg(\!
\sum_{j_{1},...,j_{N}=0,...,0}^{3,...,3} \! \! \! \! \! \! \! \! \!
\alpha_{j_{1},...,j_{N}} \! \times \! (\sigma_{j_{1}} \!
\otimes ... \otimes \sigma_{j_{N}}) \! \Bigg) \! \Bigg],$$ where $\sigma_{i}$ are the Pauli matrices for $i \in \{1,2,3\}$ and $\sigma_0$ is the $2\times 2$ identity matrix. This parametrisation allows the use of the training rule of Eq. \[eq:learningrule\], but replacing the weight $w^{(l)}_{jk}$ with 