# Building a function out of a given domain and range

How does one build a function while given domain and range ? For example, the domain $$(0,5]$$ and range $$[0, \infty)$$

To start we can think of the square root of a quadratic function with zeros $$0$$ and $$5$$ and positive between them, e.g. $$\sqrt{x(5-x)}.$$

Its domain $$[0,5]$$ is "quite perfect" (but not the range).

We have to exclude $$0$$ from the domain. This will be done if we divide by $$x.$$ Here we realize that the signs of $$\;x(5-x)\;$$ and $$\;\dfrac{5-x}{x}\;$$ are equal.

Thus consider the function $$f(x)=\sqrt{\frac {5-x}{x}}.$$

Here we successfully reduced the domain to $$(0,5].$$ Moreover, the range is $$[0,\infty)$$ as required.

Hint: When you see square brackets in your domain/range, you know that your function must contain the point with the $$x$$ and $$y$$ values that have the square brackets. In your example, the function must contain the point $$(5,0)$$.

In terms of defining particular functions that will satisfy these conditions, you may simply define a function with infinite range over a specific domain, for example: $$\frac{1}{e^{\left(x-5\right)}}-1 \ \ \ \ \ 0< x\leq5$$However, if you want to define a function that will satisfy these conditions for all $$x$$ values, I recommend using $$y = \arcsin(x)$$ or $$y = \arccos(x)$$ for finite domain and infinite range, and $$y = \sin(x)$$ or $$y = cos(x)$$ for finite range with infinite domain. For your example, something like: $$\left|\frac{1}{\arcsin\left(\frac{2x}{5}-1\right)x}\right|$$ should do the trick.

• I did not take sin and cos yet in my course, is there be any other solution to do this? Commented Feb 6, 2019 at 17:23

something like

$$f(x)= \frac 1x - \frac 15$$ seems like it would fit the bill.

or $$g(x) = -\ln x + \ln 5$$

I am looking to map the open end in the domain with the open end in the range, and the closed end of the domain with the closed end of the range. It is not entirely necessary, but if we don't it seems to me that we have to start looking for discontinuous functions.

$$f(x)$$ approaches infinity as x approaches 0. And $$f(5) = 0$$

Any function with asymptotic behavior around $$0$$ should be a good place to start. Then we do what we need to to fit the endpoint the other endpoint. Functions that are strictly decreasing will be nice, to take away the possibility that they might dip below 0. And continuous functions are nice, as they will go through every point between the extreme values of the range.

• Domains do not convince Commented Feb 6, 2019 at 21:42
• @user376343 sorry, I don't understand your comment. Commented Feb 6, 2019 at 21:45
• The domain has to be $(0,5]$ and the range $[0,\infty).$ Commented Feb 6, 2019 at 21:47
• The function is defined everywhere in the domain. Just because we could extend the domain, doesn't mean that we must. Commented Feb 6, 2019 at 22:11
• It's your view. Domain and range are defined as the largest set such that... At OP's level for sure. Commented Feb 6, 2019 at 22:48