---
title: Piecewise function
slug: piecewise-function
qid: 
snapshot: enwiki-001360908405
content_hash: 
license: CC BY-SA 4.0
source: https://en.wikipedia.org/w/index.php?oldid=1360908405
tags: [111829125, 22963279, 23118434, 23603337, 24043274, 29176345]
---

# Piecewise function

> [!note] Provenance
> Snapshot `enwiki-001360908405` · content root `…`
> Derived from <https://en.wikipedia.org/w/index.php?oldid=1360908405> · Licensed CC BY-SA 4.0

f(x) = \left\{ \begin{array}{lll} -3-x & \text{if} & x \leq -3 \\ x+3 & \text{if} & -3 \leq x \leq 0 \\ 3-2x & \text{if} & 0 \leq x \leq 3 \\ 0.5x - 4.5 & \text{if} & 3 \leq x \\ \end{array} \right. In mathematics, a piecewise function (also called a piecewise-defined function, a hybrid function, or a function defined by cases) is a function whose domain is partitioned into several intervals ("subdomains") on which the function may be defined differently. Piecewise definition is actually a way of specifying the function, rather than a characteristic of the resulting function itself, as every function whose domain contains at least two points can be rewritten as a piecewise function. The first three paragraphs of this article only deal with this first meaning of "piecewise". Terms like piecewise linear, piecewise smooth, piecewise continuous, and others are also very common. The meaning of a function being piecewise P , for a property P , is roughly that the domain of the function can be partitioned into pieces on which the property P holds, but this term is used slightly differently by different authors. Unlike the first meaning, this is a property of the function itself and not only a way to specify it. Sometimes the term is used in a more global sense involving triangulations; see Piecewise linear manifold.

f(x) = \left\{ \begin{array}{lll} -3-x & \text{if} & x \leq -3 \\ x+3 & \text{if} & -3 \leq x \leq 0 \\ 3-2x & \text{if} & 0 \leq x \leq 3 \\ 0.5x - 4.5 & \text{if} & 3 \leq x \\ \end{array} \right. In mathematics, a piecewise function (also called a piecewise-defined function, a hybrid function, or a function defined by cases) is a function whose domain is partitioned into several intervals ("subdomains") on which the function may be defined differently. Piecewise definition is actually a way of specifying the function, rather than a characteristic of the resulting function itself, as every function whose domain contains at least two points can be rewritten as a piecewise function. The first three paragraphs of this article only deal with this first meaning of "piecewise". Terms like piecewise linear, piecewise smooth, piecewise continuous, and others are also very common. The meaning of a function being piecewise P , for a property P , is roughly that the domain of the function can be partitioned into pieces on which the property P holds, but this term is used slightly differently by different authors. Unlike the first meaning, this is a property of the function itself and not only a way to specify it. Sometimes the term is used in a more global sense involving triangulations; see Piecewise linear manifold. |x| = \begin{cases} -x, & \text{if } x For all values of x less than zero, the first sub-function ( -x ) is used, which negates the sign of the input value, making negative numbers positive. For all values of x greater than or equal to zero, the second sub-function is used, which evaluates trivially to the input value itself. The following table documents the absolute value function at certain values of x : In order to evaluate a piecewise-defined function at a given input value, the appropriate subdomain needs to be chosen in order to select the correct sub-function—and produce the correct output value. f(x)= \begin{cases} \exp\left( -\frac{1}{1 - x^2}\right), & x \in (-1,1) \\ 0, & \text{otherwise} \end{cases} and some other common Bump functions. These are infinitely differentiable, but analyticity holds only piecewise. f(x) = \left\{ \begin{array}{lll} x^2 & \text{if} & x Its only discontinuity is at x_0 = 0.707 . A piecewise-defined function is continuous on a given interval in its domain if the following conditions are met: its sub-functions are continuous on the corresponding intervals (subdomains), there is no discontinuity at an endpoint of any subdomain within that interval. The pictured function, for example, is piecewise-continuous throughout its subdomains, but is not continuous on the entire domain, as it contains a jump discontinuity at x_0 . The filled circle indicates that the value of the right sub-function is used in this position. For a piecewise-defined function to be differentiable on a given interval in its domain, the following conditions have to fulfilled in addition to those for continuity above: its sub-functions are differentiable on the corresponding open intervals, the one-sided derivatives exist at all intervals' endpoints, at the points where two subintervals touch, the corresponding one-sided derivatives of the two neighboring subintervals coincide. ==References==
