This document describes the derivation of the structural stiffness matrix used in structural analysis. It shows that the strain is related to displacement and geometry. The strain energy of an element is then related to the forces and displacements. Equating the partial derivative of the total potential energy to zero results in a system of equations that can be written in matrix form as KQ=F, where K is the structural stiffness matrix, Q are the nodal displacements, and F are the applied nodal forces. This generalized matrix equation is used for structural analysis.