---
title: "FunctionSurjective"
language: "en"
type: "Symbol"
summary: "FunctionSurjective[f, x] tests whether f(x) == y has at least one solution x \\[Element] Reals for each y \\[Element] Reals. FunctionSurjective[f, x, dom] tests whether f(x) == y has at least one solution x \\[Element] dom for each y \\[Element] dom. FunctionSurjective[{f1, f2, ...}, {x1, x2, ...}, dom] tests whether f1(x1, x2, ...) == y1, f2(x1, x2, ...) == y2, ... has at least one solution x1, x2, ... \\[Element] dom for each y1, y2, ... \\[Element] dom. FunctionSurjective[{funs, xcons, ycons}, xvars, yvars, dom] tests whether funs(xvars) == yvars has at least one solution with xvars \\[Element] dom restricted by the constraints xcons for each yvars \\[Element] dom restricted by the constraints ycons."
keywords: 
- surjective
- surjective function
- surjective mapping
- onto function
- onto mapping
- onto
canonical_url: "https://reference.wolfram.com/language/ref/FunctionSurjective.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Properties of Mathematical Functions & Sequences"
    link: "https://reference.wolfram.com/language/guide/FunctionProperties.en.md"
related_functions: 
  - 
    title: "FunctionInjective"
    link: "https://reference.wolfram.com/language/ref/FunctionInjective.en.md"
  - 
    title: "FunctionBijective"
    link: "https://reference.wolfram.com/language/ref/FunctionBijective.en.md"
  - 
    title: "FunctionDomain"
    link: "https://reference.wolfram.com/language/ref/FunctionDomain.en.md"
  - 
    title: "FunctionRange"
    link: "https://reference.wolfram.com/language/ref/FunctionRange.en.md"
  - 
    title: "Solve"
    link: "https://reference.wolfram.com/language/ref/Solve.en.md"
  - 
    title: "Resolve"
    link: "https://reference.wolfram.com/language/ref/Resolve.en.md"
---
# FunctionSurjective

FunctionSurjective[f, x] tests whether $f(x)=y$ has at least one solution $x\in \mathbb{R}$ for each y∈Reals.

FunctionSurjective[f, x, dom] tests whether $f(x)=y$ has at least one solution x∈dom for each y∈dom.

FunctionSurjective[{f1, f2, …}, {x1, x2, …}, dom] tests whether $f_1\left(x_1,x_2,\ldots \right)=y_1,f_2\left(x_1,x_2,\ldots \right)=y_2,\ldots$ has at least one solution x1, x2, …∈dom for each y1, y2, …∈dom.

FunctionSurjective[{funs, xcons, ycons}, xvars, yvars, dom] tests whether $\text{\textit{funs}}(\text{\textit{xvars}})=\text{\textit{yvars}}$ has at least one solution with xvars∈dom restricted by the constraints xcons for each yvars∈dom restricted by the constraints ycons.

## Details and Options

* A surjective function is also known as onto or an onto mapping.

* A function $f(x)$ is surjective if for every $y$ there is at least one $x$ such that $f(x)=y$.

[image]

* If ``funs`` contains parameters other than ``xvars``, the result is typically a ``ConditionalExpression``.

* Possible values for ``dom`` are ``Reals`` and ``Complexes``. If ``dom`` is ``Reals``, then all variables, parameters, constants and function values are restricted to be real.

* The domain of ``funs`` is restricted by the condition given by ``FunctionDomain``.

* ``xcons`` and ``ycons`` can contain equations, inequalities or logical combinations of these.

* ``FunctionSurjective[{funs, xcons, ycons}, xvars, yvars, dom]`` returns ``True`` if the mapping $\text{\textit{funs}}|_{S\cap \text{\textit{funs}}^{-1}(T)}:S\cap \text{\textit{funs}}^{-1}(T)\to T$ is surjective, where $S$ is the solution set of ``xcons`` and $T$ is the solution set of ``ycons``.

* The following options can be given:

|                     |                   |                                              |
| ------------------- | ----------------- | -------------------------------------------- |
| Assumptions         | \$Assumptions     | assumptions on parameters                    |
| GenerateConditions  | True              | whether to generate conditions on parameters |
| PerformanceGoal     | \$PerformanceGoal | whether to prioritize speed or quality       |

* Possible settings for ``GenerateConditions`` include:

|           |                                             |
| --------- | ------------------------------------------- |
| Automatic | nongeneric conditions only                  |
| True      | all conditions                              |
| False     | no conditions                               |
| None      | return unevaluated if conditions are needed |

* Possible settings for ``PerformanceGoal`` are ``"Speed"`` and ``"Quality"``.

---

## Examples (35)

### Basic Examples (4)

Test surjectivity of a univariate function over the reals:

```wl
In[1]:= FunctionSurjective[Tan[x], x]

Out[1]= True
```

---

Test surjectivity over the complexes:

```wl
In[1]:= FunctionSurjective[Tan[x], x, Complexes]

Out[1]= False
```

---

Test surjectivity of a polynomial mapping over the reals:

```wl
In[1]:= FunctionSurjective[{x + y ^ 3, y - x ^ 5}, {x, y}]

Out[1]= True
```

---

Test surjectivity of a polynomial with symbolic coefficients:

```wl
In[1]:= FunctionSurjective[a x ^ 2 + b x y + c y ^ 2, {x, y}]

Out[1]=
ConditionalExpression[True, Element[a | b | c, Reals] && 
  ((a == 0 && b != 0) || (a != 0 && b^2 - 4*a*c > 0))]
```

### Scope (12)

Surjectivity over the reals:

```wl
In[1]:= FunctionSurjective[x ^ 3 - x, x]

Out[1]= True
```

Each value is attained at least once:

```wl
In[2]:= Plot[{x ^ 3 - x, 1 / 4}, {x, -2, 2}]

Out[2]= [image]
```

---

Surjectivity over a subset of the reals:

```wl
In[1]:= FunctionSurjective[{x ^ 3 - x, x > 0}, x]

Out[1]= False
```

For positive $x$, some values are not attained:

```wl
In[2]:= Plot[{x ^ 3 - x, -1}, {x, 0, 2}]

Out[2]= [image]
```

---

Surjectivity onto a subset of the reals:

```wl
In[1]:= FunctionSurjective[{x ^ 3 - x, x > 0, y > 0}, x, y]

Out[1]= True
```

Each positive value $y$ is for some positive $x$ :

```wl
In[2]:= Plot[{x ^ 3 - x, 1}, {x, 0, 2}]

Out[2]= [image]
```

---

Surjectivity over the complexes:

```wl
In[1]:= FunctionSurjective[E ^ x, x, Complexes]

Out[1]= False
```

The value zero is not attained:

```wl
In[2]:= Reduce[E ^ x == 0, x]

Out[2]= False
```

---

Surjectivity onto a subset of complexes:

```wl
In[1]:= FunctionSurjective[{E ^ x, True, y ≠ 0}, x, y, Complexes]

Out[1]= True
```

---

Surjectivity over the integers:

```wl
In[1]:= FunctionSurjective[{x / 2 + 1, Element[x, Integers], Element[y, Integers]}, x, y]

Out[1]= True
```

---

Surjectivity of linear mappings:

```wl
In[1]:= A = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};

In[2]:= FunctionSurjective[A.{x, y, z}, {x, y, z}]

Out[2]= False

In[3]:= B = {{1, 2, 3}, {4, 5, 6}, {7, 8, 0}};

In[4]:= FunctionSurjective[B.{x, y, z}, {x, y, z}]

Out[4]= True
```

A linear mapping is surjective iff the rank of its matrix is equal to the dimension of its codomain:

```wl
In[5]:= {MatrixRank[A], MatrixRank[B]}

Out[5]= {2, 3}
```

---

Surjectivity of polynomial mappings $\mathbb{R}^2\to \mathbb{R}$ :

```wl
In[1]:= FunctionSurjective[x ^ 2 + x y - y ^ 2, {x, y}]

Out[1]= True
```

Each value is attained at least once:

```wl
In[2]:= Plot3D[{x ^ 2 + x y - y ^ 2, -1}, {x, -3, 3}, {y, -3, 3}]

Out[2]= [image]
```

This mapping is not surjective:

```wl
In[3]:= FunctionSurjective[x ^ 2 + x y + y ^ 2, {x, y}]

Out[3]= False
```

Some values are not attained:

```wl
In[4]:= Plot3D[{x ^ 2 + x y + y ^ 2, -1}, {x, -3, 3}, {y, -3, 3}]

Out[4]= [image]
```

---

Surjectivity of polynomial mappings $\mathbb{R}^2\to \mathbb{R}^2$ :

```wl
In[1]:= FunctionSurjective[{x + y ^ 2, y - x ^ 2}, {x, y}]

Out[1]= False
```

---

Surjectivity of polynomial mappings $\mathbb{C}^2\to \mathbb{C}^2$ :

```wl
In[1]:= FunctionSurjective[{x + y ^ 2, y - x ^ 2}, {x, y}, Complexes]

Out[1]= True
```

---

Surjectivity of a real polynomial with symbolic parameters:

```wl
In[1]:= FunctionSurjective[a x ^ 2 + b x + c, x]

Out[1]= ConditionalExpression[False, Element[a | b | c, Reals] && a != 0]
```

---

Surjectivity of a real polynomial mapping with symbolic parameters:

```wl
In[1]:= FunctionSurjective[{x ^ 2 + 2 x y, y ^ 2 + a x y}, {x, y}]

Out[1]= ConditionalExpression[True, Element[a, Reals] && a > 1/2]
```

### Options (4)

#### Assumptions (1)

``FunctionSurjective`` gives a conditional answer here:

```wl
In[1]:= FunctionSurjective[{x ^ 2 + 2 x y, y ^ 2 + a x y}, {x, y}]

Out[1]= ConditionalExpression[True, Element[a, Reals] && a > 1/2]
```

This checks the surjectivity for the remaining real values of $a$ :

```wl
In[2]:= FunctionSurjective[{x ^ 2 + 2 x y, y ^ 2 + a x y}, {x, y}, Assumptions -> a ≤ 1 / 2]

Out[2]= False
```

#### GenerateConditions (2)

By default, ``FunctionSurjective`` may generate conditions on symbolic parameters:

```wl
In[1]:= FunctionSurjective[a x ^ 2 + b x y + c y ^ 2, {x, y}]

Out[1]=
ConditionalExpression[True, Element[a | b | c, Reals] && 
  ((a == 0 && b != 0) || (a != 0 && b^2 - 4*a*c > 0))]
```

With ``GenerateConditions -> None``, ``FunctionSurjective`` fails instead of giving a conditional result:

```wl
In[2]:= FunctionSurjective[a x ^ 2 + b x y + c y ^ 2, {x, y}, GenerateConditions -> None]

Out[2]= FunctionSurjective[a x^2 + b x y + c y^2, {x, y}, GenerateConditions -> None]
```

This returns a conditionally valid result without stating the condition:

```wl
In[3]:= FunctionSurjective[a x ^ 2 + b x y + c y ^ 2, {x, y}, GenerateConditions -> False]

Out[3]= True
```

---

By default, all conditions are reported:

```wl
In[1]:= FunctionSurjective[a x ^ 2 + b x + c, x]

Out[1]= ConditionalExpression[False, Element[a | b | c, Reals] && a != 0]
```

With ``GenerateConditions -> Automatic``, conditions that are generically true are not reported:

```wl
In[2]:= FunctionSurjective[a x ^ 2 + b x + c, x, GenerateConditions -> Automatic]

Out[2]= ConditionalExpression[False, Element[a | b | c, Reals]]
```

#### PerformanceGoal (1)

Use ``PerformanceGoal`` to avoid potentially expensive computations:

```wl
In[1]:= FunctionSurjective[x ^ 2 + y ^ 2 + a x y, {x, y}, PerformanceGoal -> "Speed"]

Out[1]= FunctionSurjective[x^2 + a x y + y^2, {x, y}, PerformanceGoal -> "Speed"]
```

The default setting uses all available techniques to try to produce a result:

```wl
In[2]:= FunctionSurjective[x ^ 2 + y ^ 2 + a x y, {x, y}]

Out[2]= ConditionalExpression[True, Element[a, Reals] && (-2 - a > 0 || -2 + a > 0)]
```

### Applications (11)

#### Basic Applications (7)

Check surjectivity of $\log \left(x^2\right)$ :

```wl
In[1]:= FunctionSurjective[Log[x ^ 2], x]

Out[1]= True
```

$\log \left(x^2\right)$ is surjective because it attains each value at least once:

```wl
In[2]:= Plot[{Log[x ^ 2], -1, 1}, {x, -3, 3}]

Out[2]= [image]
```

Check surjectivity of $\text{csch}(x)$ :

```wl
In[3]:= FunctionSurjective[Csch[x], x]

Out[3]= False
```

$\text{csch}(x)$ is not surjective because the value $0$ is not attained:

```wl
In[4]:= Plot[{Csch[x], 0}, {x, -2, 2}]

Out[4]= [image]
```

---

$\sqrt{x}$ is not surjective because it does not attain negative values:

```wl
In[1]:= FunctionSurjective[Sqrt[x], x]

Out[1]= False
```

The value $-1$ is not attained:

```wl
In[2]:= Plot[{Sqrt[x], -1}, {x, -2, 2}]

Out[2]= [image]
```

$\sqrt{x}$ is surjective as a function from $\mathbb{R}_{\geq \, 0}$ to $\mathbb{R}_{\geq \, 0}$ :

```wl
In[3]:= FunctionSurjective[{Sqrt[x], x ≥ 0, y ≥ 0}, x, y]

Out[3]= True
```

Each non-negative value is attained:

```wl
In[4]:= Plot[{Sqrt[x], 1}, {x, 0, 4}, PlotRange -> All]

Out[4]= [image]
```

---

$C(x)$ is surjective:

```wl
In[1]:= FunctionSurjective[CatalanNumber[x], x]

Out[1]= True
```

Each value is attained at least once:

```wl
In[2]:= Plot[{CatalanNumber[x], -1, 1 / 2, 2}, {x, -2.5, 2.5}]

Out[2]= [image]
```

$\text{Ci}(x)$ is not surjective:

```wl
In[3]:= FunctionSurjective[CosIntegral[x], x]

Out[3]= False
```

Some values, e.g. $3/4$, are not attained:

```wl
In[4]:= Plot[{CosIntegral[x], 3 / 4}, {x, -1, 10}]

Out[4]= [image]
```

---

A function is surjective if any horizontal line intersects its graph at least once:

```wl
In[1]:= FunctionSurjective[RiemannSiegelTheta[x], x]

Out[1]= True

In[2]:= Manipulate[Plot[{RiemannSiegelTheta[x], a}, ...], {{a, 2}, -5, 5}]

Out[2]= DynamicModule[«8»]
```

If a horizontal line does not intersect the graph, the function is not surjective:

```wl
In[3]:= FunctionSurjective[FresnelS[x], x]

Out[3]= False

In[4]:= Manipulate[Plot[{FresnelS[x], a}, ...], {{a, 0.8}, -1, 1}]

Out[4]= DynamicModule[«8»]
```

---

$\sin (x)$ is bounded:

```wl
In[1]:= MaxValue[Abs[Sin[x]], x]

Out[1]= 1
```

Bounded functions are not surjective:

```wl
In[2]:= FunctionSurjective[Sin[x], x]

Out[2]= False
```

---

If $f$ is continuous on $[a,b]$ and $f(a)<f(b)$, then $f$ is surjective onto $[f(a),f(b)]$ :

```wl
In[1]:= f[x_] := x ^ 4 - 2x ^ 2 + x / 2 + 1

In[2]:= f[-3 / 2] < f[3 / 2]

Out[2]= True
```

Use ``FunctionContinuous`` to check that $f$ is continuous in $[-3/2,3/2]$ :

```wl
In[3]:= FunctionContinuous[{f[x], -3 / 2 ≤ x ≤ 3 / 2}, x]

Out[3]= True
```

By the intermediate value theorem, $f$ restricted to $[-3/2,3/2]$ is surjective onto $[f(-3/2),f(3/2)]$ :

```wl
In[4]:= FunctionSurjective[{f[x], -3 / 2 ≤ x ≤ 3 / 2, f[-3 / 2] ≤ y ≤ f[3 / 2]}, x, y]

Out[4]= True

In[5]:= Plot[{f[x], f[-3 / 2], f[3 / 2]}, {x, -3 / 2, 3 / 2}, Rule[...]]

Out[5]= [image]
```

---

An affine mapping $A.x+b$ is surjective if the rank of $A$ is equal to the number of rows of $A$ :

```wl
In[1]:= Subscript[A, 1] = {{1, 2, 3}, {4, 5, 6}};

In[2]:= MatrixRank[Subscript[A, 1]]

Out[2]= 2

In[3]:= FunctionSurjective[Subscript[A, 1].{x, y, z} + {7, 8}, {x, y, z}]

Out[3]= True

In[4]:= Subscript[A, 2] = {{1, 2, 3}, {2, 4, 6}};

In[5]:= MatrixRank[Subscript[A, 2]]

Out[5]= 1

In[6]:= FunctionSurjective[Subscript[A, 2].{x, y, z} + {7, 8}, {x, y, z}]

Out[6]= False
```

#### Solving Equations and Inequalities (1)

A function $f(x)$ is surjective if the equation $f(x)=y$ has at least one solution for any $y$ :

```wl
In[1]:= f[x_] := x / (x ^ 2 - 1)

In[2]:= FunctionSurjective[f[x], x]

Out[2]= True
```

For each real $y$, there is at least one real solution for $x$ :

```wl
In[3]:= Reduce[f[x] == y, x, Reals]

Out[3]= (y < 0 && (x == (1/2 y) - (1/2) Sqrt[(1 + 4 y^2/y^2)] || x == (1/2 y) + (1/2) Sqrt[(1 + 4 y^2/y^2)])) || (y == 0 && x == 0) || (y > 0 && (x == (1/2 y) - (1/2) Sqrt[(1 + 4 y^2/y^2)] || x == (1/2 y) + (1/2) Sqrt[(1 + 4 y^2/y^2)]))
```

Use ``Resolve`` to check the condition expressed using quantifiers:

```wl
In[4]:= Resolve[ForAll[y, Exists[x, f[x] == y]], Reals]

Out[4]= True

In[5]:= Plot[f[x], {x, -3, 3}]

Out[5]= [image]
```

#### Probability & Statistics (3)

A ``CDF`` for a continuous distribution is surjective onto the interval of probabilities ``(0, 1)`` over its domain:

```wl
In[1]:= cdf = CDF[NormalDistribution[0, 1], x]

Out[1]= (1/2) Erfc[-(x/Sqrt[2])]

In[2]:= Plot[cdf, {x, -3, 3}]

Out[2]= [image]

In[3]:= FunctionSurjective[{cdf, True, 0 < y < 1}, x, y]

Out[3]= True
```

---

A ``SurvivalFunction`` for a continuous distribution is surjective onto the interval of probabilities ``(0, 1)`` over its domain:

```wl
In[1]:= sf = SurvivalFunction[NormalDistribution[0, 1], x]

Out[1]= (1/2) Erfc[(x/Sqrt[2])]

In[2]:= Plot[sf, {x, -3, 3}]

Out[2]= [image]

In[3]:= FunctionSurjective[{sf, True, 0 < y < 1}, x, y]

Out[3]= True
```

---

The quantile function ``Quantile`` for a distribution is surjective onto the domain of the distribution:

```wl
In[1]:= qf = Quantile[NormalDistribution[0, 1], q]

Out[1]= ConditionalExpression[(-Sqrt[2])*InverseErfc[2*q], 0 <= q <= 1]

In[2]:= Plot[qf, {q, 0, 1}]

Out[2]= [image]

In[3]:= FunctionSurjective[{qf, 0 < q < 1}, q]

Out[3]= True
```

### Properties & Relations (3)

$f(x)$ is surjective iff the equation $f(x)=y$ has at least one solution for each $y$ :

```wl
In[1]:= FunctionSurjective[x ^ 2 + x + 1, x]

Out[1]= False

In[2]:= FunctionSurjective[x ^ 3 + x + 1, x]

Out[2]= True
```

Use ``Solve`` to find the solutions:

```wl
In[3]:= Solve[x ^ 2 + x + 1 == y, x, Reals]

Out[3]= {{x -> ConditionalExpression[-(1/2) - (1/2)*Sqrt[-3 + 4*y], y > 3/4]}, {x -> ConditionalExpression[-(1/2) + (1/2)*Sqrt[-3 + 4*y], y > 3/4]}}

In[4]:= Solve[x ^ 3 + x + 1 == y, x, Reals]

Out[4]= {{x -> Root[1 - y + #1 + #1^3&, 1]}}
```

---

A real continuous function on an interval is surjective iff the limits at endpoints are $-\infty$ and $\infty$ :

```wl
In[1]:= FunctionSurjective[{Sec[x], -Pi / 2 < x < Pi / 2}, x]

Out[1]= False

In[2]:= FunctionSurjective[{Tan[x], -Pi / 2 < x < Pi / 2}, x]

Out[2]= True

In[3]:= Plot[{Sec[x], Tan[x]}, {x, -Pi / 2, Pi / 2}]

Out[3]= [image]
```

Use ``Limit`` to compute the limits:

```wl
In[4]:= Limit[{Sec[x], Tan[x]}, x -> -Pi / 2, Direction -> "FromAbove"]

Out[4]= {∞, -∞}

In[5]:= Limit[{Sec[x], Tan[x]}, x -> Pi / 2, Direction -> "FromBelow"]

Out[5]= {∞, ∞}
```

---

A function is surjective if its ``FunctionRange`` is ``True`` :

```wl
In[1]:= FunctionRange[x Sin[x], x, y]

Out[1]= True

In[2]:= FunctionSurjective[x Sin[x], x]

Out[2]= True
```

### Possible Issues (1)

``FunctionSurjective`` determines the real domain of functions using ``FunctionDomain`` :

```wl
In[1]:= FunctionSurjective[{Cosh[Sqrt[x]], True, y ≥ 0}, x, y]

Out[1]= False
```

$\cosh \left(\sqrt{x}\right)$ is not surjective onto $y\geq 0$ in the real domain reported by ``FunctionDomain`` :

```wl
In[2]:= FunctionDomain[Cosh[Sqrt[x]], x]

Out[2]= x ≥ 0

In[3]:= Plot[{Cosh[Sqrt[x]], 1 / 2}, {x, 0, 10}]

Out[3]= [image]
```

$\cosh \left(\sqrt{x}\right)$ is real valued over the whole reals and is surjective onto $y\geq 0$ :

```wl
In[4]:= Plot[{Cosh[Sqrt[x]], 1 / 2}, {x, -10, 10}]

Out[4]= [image]
```

All subexpressions of $f$ need to be real valued for a point to belong to the real domain of $f$ :

```wl
In[5]:= Refine[Element[Sqrt[x], Reals], x < 0]

Out[5]= False
```

## See Also

* [`FunctionInjective`](https://reference.wolfram.com/language/ref/FunctionInjective.en.md)
* [`FunctionBijective`](https://reference.wolfram.com/language/ref/FunctionBijective.en.md)
* [`FunctionDomain`](https://reference.wolfram.com/language/ref/FunctionDomain.en.md)
* [`FunctionRange`](https://reference.wolfram.com/language/ref/FunctionRange.en.md)
* [`Solve`](https://reference.wolfram.com/language/ref/Solve.en.md)
* [`Resolve`](https://reference.wolfram.com/language/ref/Resolve.en.md)

## Related Guides

* [Properties of Mathematical Functions & Sequences](https://reference.wolfram.com/language/guide/FunctionProperties.en.md)

## History

* [Introduced in 2020 (12.2)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn122.en.md)