Domain and range
The domain and range of a function is all the possible values of the independent variable, x, for which y is defined. The range of a function is all the possible values of the dependent variable y.
The example below shows two different ways that a function can be represented: as a function table, and as a set of coordinates.

or  {(2, 4), (3, 8), (5,2), (6,9), (8,3)} 
Even though they are represented differently, the above are the same function, and the domain of the function is x = {2, 3, 5, 6, 8} and the range is y = {4, 8, 2, 9, 3}. This is how you can defined the domain and range for discrete functions. The order in which you list the values does not matter. But how do you define the domain and range for functions that are not discrete?
Example
f(x) = x^{2}
The function f(x) = x^{2} has a domain of all real numbers (x can be anything) and a range that is greater than or equal to zero.
Two ways in which the domain and range of a function can be written are: interval notation and set notation.
interval notation
When using interval notation, domain and range are written as intervals of values. For f(x) = x^{2}, the domain in interval notation is:
D: (∞, ∞)
D indicates that you are talking about the domain, and (∞, ∞), read as negative infinity to positive infinity, is another way of saying that the domain is "all real numbers."
The range of f(x) = x^{2} in interval notation is:
R: [0,∞]
R indicates that you are talking about the range. Notice that a bracket is used for the 0 instead of a parenthesis. This is because the range of a function includes 0 at x = 0. The range of the function excludes ∞ (every function does), which is why we use a round bracket.
On a graph, you know when a function includes or excludes an endpoint because the endpoint will be open or closed.
set notation
When using set notation, we use inequality symbols to describe the domain and range as a set of values. The domains and ranges used in the discrete function examples were simplified versions of set notation. There are many different symbols used in set notation, but only the most basic of structures will be provided here.
The domain of f(x) = x^{2} in set notation is:
D: {x  x∈ℝ}
Again, D indicates domain. The "" means "such that," the symbol ∈ means "element of," and "ℝ" means "all real numbers."
Putting it all together, this statement can be read as "the domain is the set of all x such that x is an element of all real numbers."
The range of f(x) = x^{2} in set notation is:
R: {y  y ≥ 0}
R indicates range. When using set notation, inequality symbols such as ≥ are used to describe the domain and range. Therefore, this statement can be read as "the range is the set of all y such that y is greater than or equal to zero."