# Thread: Finding a function from a given domain and range problem.

1. ## Finding a function from a given domain and range problem.

So I'm not sure if this is the right forum area (newbie) so forgive me if its misplaced. Here's the problem I'm having. I have a specific domain and a specific range. I'd like to find the function that can be defined for the given domain and range. The function is ONTO but not one to one. The domain is {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}, the range is {1, 2, 3, 4, 5, 6}. This domain and range has a specific graph such that for the subset of the domain {2, 3, 4, 5, 6, 7} the function to the set (note range is same for two subsets) is equal to f(x) = x - 1. The function of the subset {7, 8, 9, 10, 11, 12} to the range is equal to f(x) = -x + 13. As you can see these functions are the basic slope intercept form of a linear equation (simplified) for two lines that meet at point (7, 6). Hence 7 being in both subsets. However a domain with a unique value in the range is (by definition) a function. So I'm trying to incorporate both lines in such a way that there is one function and for every value of x we can find y given the knowledge of each linear equations behavior. Is there a way to combine these functions so that whatever the value of x is, the correct value of y is produced for the given domain and range? (It's okay if the function can calculate for values outside of the domain). Any suggestions / ideas / thoughts?

2. ## Re: Finding a function from a given domain and range problem.

Are you trying to restrict the domain so as to form a composite function?

3. ## Re: Finding a function from a given domain and range problem.

Originally Posted by astartleddeer
Are you trying to restrict the domain so as to form a composite function?
I'm not sure exactly what you mean lol. My math needs work. However I think I actually already have the solution as stated above. I was under the impression that a function could be defined by one formula, like a magic formula, however after looking at it I think that a function can be defined by two formulas with restrictions. In this case I would just define the function for the aforementioned domain and range as:
{For all integers of x satisfying : 2<= x <= 7 -> f(x) = x - 1
{For all integers of x satisfying : 8 <= x <= 12 -> f(x) = -1x + 13

Essentially the two formulas of the function define perpendicular lines with a slope of 1 (and -1); one intercepting the y access at 13 (slope -1), the other at -1 (slope 1). Which satisfies the given domain and range as long as the values are restricted as indicated. However. If there is a way to add these two functions (since the perpendicular lines are infinite there is no need to restrict the domain and range only that they satisfy the relationship between the two), to create one formula then I would love to know it lol. Thanks.