The basic supply and demand model is the workhorse of microeconomic and macroeconomic models. The model is not without its problems and shortcomings, many of which have been discussed in previous post: equilibrium assumption, excluding non-linearities, and a host of others, but the predictive power of the model remains one of its greatest properties.
The model consists of a system of linear equations which we are going to set up in its most general form with the equilibrium equation that supply equals demand and two behavioral equations for both the consumers and producers of a generic good. The law of demand and supply are reflected in the coefficients and matrix algebra will be used to solve the system.
The supply and demand system below; all constants are positive.
The matrix form of the system above can be found by placing all constants on one side and the variables on the other side:
The system above can be solved by taking the inverse of the A matrix using the adjoint which is the transpose of the cofactor matrix. The solution is given below after the non-zero determinant condition is verified to eliminate linear dependence between equations:
Supply equals demand and the relationships between the variables can be verified to be consistent with what we see happening in markets between consumers and producers. An increase in price encourages production and discourages consumption holding all other things constant. Increasing fixed cost for the supply function reduces the quantity supplied and increases the equilibrium price in the market. There are many other relationships that can be verified as intuitively correct for what we see in terms of market dynamics. This can be done by taking partial derivatives of the demand, supply, and solution results with respect to the 4 constants in the model: a, b, c, and d. The following Excel diagram is a pretty good interactive spreadsheet to create that will by a great way of to understand supply and demand dynamics.