Linear functions¶
Part 1 · Linear functions, polyhedra and linear programming problems · Chapter 1 · Lecture notes, volume 1 (PDF) · Slides · App: Level lines
Prerequisites
-
From the module Linear Algebra, the chapter «Vectors»: column and row vectors, the transpose and the scalar product \({\boldsymbol c}'{\boldsymbol x}\).
-
From the same module, the chapter «Matrices»: square matrices and the zero matrix.
-
From the module Mathematical Analysis 1, the chapter «The derivative function»: derivatives, used here one variable at a time as partial derivatives.
Objectives
At the end of this chapter you will be able to:
-
write the linear function associated with a vector \({\boldsymbol c} \in \R^n\);
-
compute its gradient and its Hessian, and explain why they do not depend on the point;
-
describe its level sets as hyperplanes perpendicular to the gradient, and draw them in the plane;
-
read the graph of a linear function of two variables.
1.1 Linear functions¶
Definition 1.1: linear function
Given a (column) vector
the associated (scalar) function
is called a linear function.
Definition 1.2: gradient of a linear function
The gradient (vector of the partial derivatives) of the linear function \(f({\boldsymbol x}) = {\boldsymbol c}'{\boldsymbol x}\) is:
Definition 1.3: Hessian of a linear function
The Hessian (matrix of the second partial derivatives) of the linear function \(f({\boldsymbol x}) = {\boldsymbol c}'{\boldsymbol x}\) is the \(n \times n\) matrix:
since every first partial derivative \(\frac{\partial f({\boldsymbol x})}{\partial x_j} = c_j\) is a constant.
Definition 1.4: level sets of a linear function
The level sets of the linear function \(f({\boldsymbol x}) = {\boldsymbol c}'{\boldsymbol x}\) (the sets of points in which the function is constant) are:
-
The gradient of a linear function is the same vector \({\boldsymbol c}\) at every point and, accordingly, its Hessian (matrix of the second partial derivatives) is the zero matrix everywhere.
-
The level sets of a linear function are the hyperplanes perpendicular to the gradient.
Example 1.1: gradient and level sets of linear functions
With \({\boldsymbol c}=\begin{pmatrix} 8\\ 4 \end{pmatrix}\), the associated linear function is:
Gradient:
The figure shows:
-
The gradient evaluated at \(\begin{pmatrix} 0 \\ 0 \end{pmatrix}\): \(\nabla f\left(\begin{pmatrix} 0 \\ 0 \end{pmatrix}\right) =\begin{pmatrix} 8 \\[0.5ex] 4 \end{pmatrix}\) (blue arrow)
-
Two level sets (blue dashed lines): \(8 x_1 +4 x_2 = 16\) and \(8 x_1 +4 x_2 = 40\)
Example 1.2: gradient and level sets of linear functions
With \({\boldsymbol c}=\begin{pmatrix} -8\\ -4 \end{pmatrix}\), the associated linear function is:
Gradient:
The figure shows:
-
The gradient evaluated at \(\begin{pmatrix} 0 \\ 0 \end{pmatrix}\): \(\nabla f\left(\begin{pmatrix} 0 \\ 0 \end{pmatrix}\right) =\begin{pmatrix} -8 \\[0.5ex] -4 \end{pmatrix}\) (blue arrow)
-
Two level sets (blue dashed lines): \(-8 x_1 -4 x_2 = 16\) and \(-8 x_1 -4 x_2 = 40\)
Example 1.3: graphs of linear functions
With \({\boldsymbol c}=\begin{pmatrix} 8\\ 4 \end{pmatrix}\), we have \(f\left(\begin{pmatrix} x_1 \\ x_2 \\ \end{pmatrix}\right)=8\;x_1 + 4\;x_2\). Its graph is:
Example 1.4: graphs of linear functions
With \({\boldsymbol c}=\begin{pmatrix} -8\\ -4 \end{pmatrix}\), we have \(f\left(\begin{pmatrix} x_1 \\ x_2 \\ \end{pmatrix}\right)=-8\;x_1- 4\;x_2\). Its graph is:
1.2 In summary¶
In summary
-
A linear function is \(f({\boldsymbol x}) = {\boldsymbol c}'{\boldsymbol x}\), with \({\boldsymbol c} \in \R^n\).
-
Its gradient is the same vector \({\boldsymbol c}\) at every point, and its Hessian is the zero matrix.
-
Its level sets \({\boldsymbol c}'{\boldsymbol x} = k\) are hyperplanes perpendicular to the gradient.
Interactive lab¶
The apps of this chapter: move the sliders and drag the points. Each app also opens full page in the interactive lab: Level lines.