# Dimension of weight matrix in neural network

Why would the dimension of $w^{}$ be $(n^{}, n^{})$ ?

This is a simple linear equation, $z^{[n]}= W^{[n]}a^{[n-1]} + b^{[n]}$

There seems to be an error in the screenshot. the weight, $W$ should be transposed, please correct me if I am wrong.

$W^{}$ are the weights assigned to the neurons in the layer 2

$n^{}$ is the number of neurons in layer 1

Screenshot from Andrew Ng deeplearning coursera course video: There seems to be an error in the screenshot. The weight, $W$ should be transposed, please correct me if I am wrong.
Matrix multiplication works so that if you multiply two matrices together, $C = AB$, where $A$ is an $i \times j$ matrix and $B$ is a $j \times k$ matrix, then C will be a $i \times k$ matrix. Note that $A$'s column count must equal $B$'s row count ($j$).
In the neural network, $a^{}$ is a $n^{} \times 1$ matrix (column vector), and $z^{}$ needs to be a $n^{} \times 1$ matrix, to match number of neurons.
Therefore $W^{}$ has to have dimensions $n^{} \times n^{}$ in order to generate an $n^{} \times 1$ matrix from $W^{}a^{}$