# Domain and Range of a functions

A function is a mathematical object that assigns a unique output to every input. The set of all possible inputs is called the domain of the function, and the set of all possible outputs is called the range of the function. In other words, the domain is the set of values that can be plugged into the function, and the range is the set of values that the function can produce.

Formally, a function \(f\) is a mapping from a set \(A\) (the domain) to a set \(B\) (the range), where for each \( a \in A\) , there is a unique \( b \in B \) such that \(f(a)=b \). We write \(f\): \( A \rightarrow B \) to denote that \(f\) is a function from \(A\) to \(B\).

For example, consider the function \(f(x)=x^2\), where \(x\) is a real number. The domain of \(f\) is the set of all real numbers, because any real number can be plugged into \(f\). However, the range of \(f\) is only the set of non-negative real numbers, because \(f(x)\) is always non-negative.

When finding the domain and range of a function, there are a few things to keep in mind:

- The domain of a function is the set of all possible inputs. This means that any value that causes the function to be undefined (such as dividing by zero or taking the square root of a negative number) cannot be in the domain.
- The range of a function is the set of all possible outputs. This means that the function can only produce values that are in the range.
- It is possible for different functions to have the same domain or range. For example, the functions \(f(x)=x^2 \) and \(g(x)=|x| \) both have the domain of all real numbers, but their ranges are different.
- The domain and range of a function can be determined by analyzing the graph of the function. The domain is the set of all possible x-values that appear on the graph, and the range is the set of all possible y-values that appear on the graph.

Let's look at some examples to better understand how to find the domain and range of a function.

**Example 1:** Find the domain and range of the function \( f(x) = \frac{1}{x} \)

The function \(f(x) \) is defined for all \( x \neq 0 \) because division by zero is undefined. Therefore, the domain of \(f\) is the set of all real numbers except zero, or \( (-\infty ; 0) \cup (0 ; \infty ) \).

To find the range of \(f\), we note that \(f(x) \) can be any real number except zero. This means that the range of \(f\) is also \( (-\infty ; 0 ) \cup ( 0 ; \infty ) \).

**Example 2:** Find the domain and range of the function \( f(x) = \sqrt{4-x^2} \).

The function \(f(x)\) is defined only for values of \(x\) such that \( 4 - x^2 \ge 0 \). Solving this inequality, we get \( -2 \le x \le 2 \).

Therefore, the domain of \(f\) is the closed interval \([-2,2]\). To find the range of \(f\), we note that \(f(x)\) can be any non-negative real number less than or equal to 2. This means that the range of \(f\) is the closed interval \([0,2]\).

**Example 3:** Find the domain and range of the function \(f(x)=sin(x) \).

The function \(f(x) \) is defined for all real numbers, so the domain of \(f\) is \( (-\infty , \infty) \).

To find the range of \(f\), we note that \(sin(x)\) can take on any value between -1 and 1, inclusive. Therefore, the range of \(f\) is the closed interval \([-1,1] \).

In summary, the domain of a function is the set of all possible inputs, and the range is the set of all possible outputs. The domain and range can be determined by analyzing the function itself or its graph.