# Why do we use Matrix in Perceptron instead of Functions?

Matrices are good objects to store connections between dimensions/entities. However, matrix computation is often time consuming and sometimes wasteful if matrix is too sparse. Also thinking about the fact the inverse of the matrix is $$O^n$$. I am trying to understand that why is matrix used to store information in the perceptron. Wouldn't a functional form be more compact instead of a big sparse matrix to replace a perceptron layer in the neural networks?