Canonical: https://knowlpedia.com/shared-foundations/restriction-of-a-function/

# Restriction of a function

A function obtained by limiting another function's domain to a subset.

A **restriction of a function** is a new function obtained by limiting the domain: if \(f:A\to B\) is a [function](https://knowlpedia.com/shared-foundations/function/) and \(S\subseteq A\), then the restriction \(f|_S:S\to B\) is defined by
\[
f|_S(s)=f(s)\quad\text{for all }s\in S.
\]

## Remarks

A restriction changes the [domain](https://knowlpedia.com/shared-foundations/domain/) while keeping the same [codomain](https://knowlpedia.com/shared-foundations/codomain/). The [graph](https://knowlpedia.com/shared-foundations/graph-of-function/) of \(f|_S\) is obtained by intersecting the graph of \(f\) with the subset \(S\times B\) of the [Cartesian product](https://knowlpedia.com/shared-foundations/cartesian-product/) \(A\times B\).

## Examples

- If \(f:\mathbb{R}\to\mathbb{R}\) is \(f(x)=x^2\) and \(S=\mathbb{Z}\subseteq\mathbb{R}\), then \(f|_S:\mathbb{Z}\to\mathbb{R}\) is the squaring function on integers.
- If \(A\) is a set and \(S\subseteq A\), then \(\mathrm{id}_A|_S:S\to A\) is the inclusion map \(s\mapsto s\).
