These definitions should not be used in practice and are only here to improve understanding of what happens in a dense layer, to implement a dense layer, the equations in here should be used.
A single dense neurone can be mathematically defined as
This calculation can be easily re-written using a dot product of vectors
The dimensions of the matrices in the following equations are probably not compatible for the dot products, and in practice some might need to be transposed
If the layer is not the output layer:
If the layer is the output layer: