A demand function is a mathematical representation that shows the relationship between the quantity demanded and various factors, such as price, income, and prices of related goods. A demand curve, on the other hand, is a graphical representation of the demand function, typically showing the quantity demanded at different price levels