# Describing Domain and Range

### {{ 'ml-heading-theory' | message }}

Sometimes it can be helpful to describe or analyze the set of all inputs and outputs for which a function is defined. These quantities are called

*domain*and*range*, respectively.## Domain

The domain, $D,$ is the set of all $x$-values or inputs for which a function is defined. There are two reasons for numbers to be excluded from the domain:

- The number gives a forbidden calculation, such as $\sqrt{\text{-}1}$ or $\frac{2}{0}.$
- The function describes a specific situation. Suppose, for example, $f(x)$ represents the price of $x$ apples. It does not make sense to consider the cost of $\text{-} 5$ apples. Thus, $\text{-} 5$ would not be in the domain of $f(x).$

## Range

The range, $R,$ is the set of all $y$-values or outputs a function gives. Since $y$ depends on $x,$ the domain determines the range. Some functions can result in positive and negative $y$-values, whereas others cannot. For example, consider $f(x)=2x \quad \text{and} \quad g(x) = x^2.$ For any input value, $f(x)$ will show positive and negative outputs. The range of $f(x)$ is all real numbers. Conversely, $g(x)$ will only yield non-negative outputs, since the square of a number is never negative. Then, the range of $g(x)$ is $y \geq 0.$

## Exercises

{{ 'mldesktop-placeholder-grade' | message }} {{ article.displayTitle }}!

{{ exercise.headTitle }}

*settings_overscan*

{{ 'mldesktop-selftest-notests' | message }} {{ article.displayTitle }}!

{{ tests.error }}

## {{ 'ml-heading-exercise' | message }} {{ focusmode.exercise.exerciseName }}

*keyboard_backspace*

{{ 'ml-tooltip-premium-exercise' | message }}

{{ 'ml-tooltip-recommended-exercise' | message }}

Programmeringsuppgift | {{ 'course' | message }} {{ exercise.course }}

*keyboard_backspace*{{ 'ml-btn-previous' | message }}

*keyboard_backspace*