ArticleslgStudy

mathematics

Piecewise linear function

Piecewise linear function is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Piecewise linear function rather than just read about it. In short: In mathematics, a piecewise linear or segmented function is a real-valued function of a real variable, whose graph is composed of straight-line segments. Definition A piecewise linear function is a function defined on a (possibly unbounded) interval of real numbers, such that there is a collection of intervals on each of which the function is an affine function.

Piecewise linear function — main illustration
Piecewise linear function — illustration

Key takeaways

  • Piecewise linear function belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Piecewise linear function to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Piecewise linear function from memory before moving on to harder problems.

Reference excerpt

In mathematics, a piecewise linear or segmented function is a real-valued function of a real variable, whose graph is composed of straight-line segments.

Definition A piecewise linear function is a function defined on a (possibly unbounded) interval of real numbers, such that there is a collection of intervals on each of which the function is an affine function. (Thus "piecewise linear" is actually defined to mean "piecewise affine".) If the domain of the function is compact, there needs to be a finite collection of such intervals; if the domain is not compact, it may either be required to be finite or to be locally finite in the reals.

Examples

The function defined by

f ( x ) = { − x − 3 if x ≤ − 3 x + 3 if − 3 < x < 0 − 2 x + 3 if 0 ≤ x < 3 0.5 x − 4.5 if x ≥ 3 {\displaystyle f(x)={\begin{cases}-x-3&{\text{if }}x\leq -3\\x+3&{\text{if }}-3<x<0\\-2x+3&{\text{if }}0\leq x<3\\0.5x-4.5&{\text{if }}x\geq 3\end{cases}}}

is piecewise linear with four pieces. The graph of this function is shown to the right. Since the graph of an affine(*) function is a line, the graph of a piecewise linear function consists of line segments and rays. The x values (in the above example −3, 0, and 3) where the slope changes are typically called breakpoints, changepoints, threshold values or knots. As in many applications, this function is also continuous. The graph of a continuous piecewise linear function on a compact interval is a polygonal chain. (*) A linear function satisfies by definition f ( λ x ) = λ f ( x ) {\displaystyle f(\lambda x)=\lambda f(x)} and therefore in particular f ( 0 ) = 0 {\displaystyle f(0)=0} ; functions whose graph is a straight line are affine rather than linear. There are other examples of piecewise linear functions:

Absolute value Sawtooth function Floor function Step function, a function composed of constant sub-functions, so also called a piecewise constant function Boxcar function, Heaviside step function Sign function Triangular function

Fitting to a curve

An approximation to a known curve can be found by sampling the curve and interpolating linearly between the points. An algorithm for computing the most significant points subject to a given error tolerance has been published.

Fitting to data

If partitions, and then breakpoints, are already known, linear regression can be performed independently on these partitions. However, continuity is not preserved in that case, and also there is no unique reference model underlying the observed data. A stable algorithm with this case has been derived. If partitions are not known, the residual sum of squares can be used to choose optimal separation points. However efficient computation and joint estimation of all model parameters (including the breakpoints) may be obtained by an iterative procedure currently implemented in the package segmented for the R language. A variant of decision tree learning called model trees learns piecewise linear functions.

Generalizations

The notion of a piecewise linear function makes sense in several different contexts. Piecewise linear functions may be defined on n-dimensional Euclidean space, or more generally any vector space or affine space, as well as on piecewise linear manifolds and simplicial complexes (see simplicial map). In each case, the function may be real-valued, or it may take values from a vector space, an affine space, a piecewise linear manifold, or a simplicial complex. (In these contexts, the term “linear” does not refer solely to linear transformations, but to more general affine linear functions.) In dimensions higher than one, it is common to require the domain of each piece to be a polygon or polytope. This guarantees that the graph of the function will be composed of polygonal or polytopal pieces. Splines generalize piecewise linear functions to higher-order polynomials, which are in turn generalized by piecewise-smooth and piecewise-differentiable functions.

Specializations Important sub-classes of piecewise linear functions include the continuous piecewise linear functions and the convex piecewise linear functions. In general, for every n-dimensional continuous piecewise linear function f : R n → R {\displaystyle f:\mathbb {R} ^{n}\to \mathbb {R} } , there is a

Π ∈ P ( P ( R n + 1 ) ) {\displaystyle \Pi \in {\mathcal {P}}({\mathcal {P}}(\mathbb {R} ^{n+1}))}

such that

… excerpt ends here. Continue reading the full article.

Illustrations

Piecewise linear function: A function (blue) and a piecewise linear approximation to it (red)
A function (blue) and a piecewise linear approximation to it (red)
Piecewise linear function: A piecewise linear function of two arguments (top) and the convex polytopes on which it is linear (bottom)
A piecewise linear function of two arguments (top) and the convex polytopes on which it is linear (bottom)
Piecewise linear function: Crop response to depth of the watertable[10]
Crop response to depth of the watertable[10]
Piecewise linear function: Example of crop response to soil salinity[11]
Example of crop response to soil salinity[11]

Worked examples

Example 1 — a first encounter with Piecewise linear function

Start with the simplest possible case. Write down what Piecewise linear function claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Piecewise linear function before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Piecewise linear function ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Piecewise linear function

In research
Piecewise linear function appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Piecewise linear function in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Piecewise linear function is common in secondary-school and first-year university syllabi. It links to neighbouring topics Real analysis, Types of functions, so understanding it makes those chapters shorter.
In everyday life
Look for Piecewise linear function outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Piecewise linear function in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Piecewise linear function means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Piecewise linear function out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Piecewise linear function in simple terms?

In mathematics, a piecewise linear or segmented function is a real-valued function of a real variable, whose graph is composed of straight-line segments. Definition A piecewise linear function is a function defined on a (possibly unbounded) interval of real numbers, such that there is a collection…

Why does Piecewise linear function matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Piecewise linear function?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Piecewise linear function.

Tags

  • Real analysis
  • Types of functions

Keep exploring