# Find the function of overlap?

## Main Question or Discussion Point

ummm, silly question I suppose(and one with likely no answer), and I don't know which Maths subforum to put it in. It's not a pressing thing, just a curiosity.
How do I find the equation of a section that is the overlap of two functions? Not the area of such a section(which would be using Integral), but the equation for it.

e.g I have two functions
y=x^2-4x+5
y=-x^2+6x-4

Now I can tell a program to draw this overlap using
y=[x^2-4x+5,-x^2+6x-4]{(5-sqrt(7))/2<x<(5+sqrt(7))/2}

But I would much rather have an equation proper.
Is this at all possible?

jedishrfu
Mentor
Can you explain a little more by what you mean?

The equation you are looking for will return what values?

These functions can be combined in an infinite number of ways:

$y=y1(x) + y2(x)$
$y=y1(x) * y2(x)$
$y=...$

where y1 and y2 refer to your two equations.

Is this for some project?

Mark44
Mentor
ummm, silly question I suppose(and one with likely no answer), and I don't know which Maths subforum to put it in. It's not a pressing thing, just a curiosity.
How do I find the equation of a section that is the overlap of two functions? Not the area of such a section(which would be using Integral), but the equation for it.

e.g I have two functions
y=x^2-4x+5
y=-x^2+6x-4

Now I can tell a program to draw this overlap using
y=[x^2-4x+5,-x^2+6x-4]{(5-sqrt(7))/2<x<(5+sqrt(7))/2}

But I would much rather have an equation proper.
Is this at all possible?
By "overlap" I assume you mean the bounded region in the plane that lies above the graph of $y = x^2 - 4x + 5$ and below the graph of $y = -x^2 + 6x - 4$.

There is no equation that represents this region, but if you project this region onto the x-axis, you can represent this interval by an inequality.

For the two equations you gave, both of whose graphs are parabolas, the bounded region is such that $-x^2 + 6x - 4 \ge x^2 - 4x + 5$. You can use algebraic techniques to rewrite this as a quadratic inequality, and eventually as in equality of the form $A \le x \le B$.

@jedishrfu

Well for instance the above example would have results such as:
f(0)=NULL
f(1)=NULL
f(1.5)=1.25 or 2.75
f(2)=1,4
f(2.5)=1.25 or 4.75
f(3)=2,5
f(3.5)=3.25 or 4.75
f(4)=NULL

@Mark
So you're saying that it's not possible? Even with the use of complex Numbers or some such?

Yes, you can write a program to do that. The thing you would have to clear up is when you say "or" in your examples.
For example, you say: f(1.5)=1.25 or 2.75

Does this mean the program should return either 1.25 or 2.75 randomly? Like one time you call the function and it returns 1.25 and the next time it might say 2.75?

Mark44
Mentor
How do I find the equation of a section that is the overlap of two functions?
So you're saying that it's not possible? Even with the use of complex Numbers or some such?
Generally speaking there is no equation that represents the interval you're interested in, but an inequality can be used to represent an interval, which is what I said in post #3. And complex numbers don't change things and aren't some magical fix.

A couple of examples...
$x^2 = 4$
Solution set: x = 2 or x = -2

$x^2 < 4$
Solution set: -2 < x < 2, all of the numbers between -2 and 2, excluding the two endpoints

@Mark44
You may have noticed in my response to jedishrfu that I clarify this, and even provide examples.
f(0)=NULL
f(1)=NULL
f(1.5)=1.25 or 2.75
f(2)=1 or 4
i.e. f(2) = 1, or f(2) = 4 using the system you have above.
Not 1 <= f(2) <= 4

I used inequalities to show that i wanted the shape(Perimeter(P)) of the area, not the 'area'(A) of the area.

Mark44
Mentor
@Mark44
You may have noticed in my response to jedishrfu that I clarify this, and even provide examples.
f(0)=NULL
f(1)=NULL
f(1.5)=1.25 or 2.75
f(2)=1 or 4
This doesn't make sense. A function has to have one output, not two. That's in the basic definition of a function.

I can't even guess at what you're trying to do here. The question, as I understand it, is to find the interval over whiich two graphs overlap (i.e., the two graphs completely bound some region).
AtlasSniperma said:
i.e. f(2) = 1, or f(2) = 4 using the system you have above.
Not 1 <= f(2) <= 4

I used inequalities to show that i wanted the shape(Perimeter(P)) of the area, not the 'area'(A) of the area.
I'm not calculating the area. I'm showing the that graphs of the two parabolas you gave as examples "overlap" over some interval of the form $A \le x \le B$.

The shape of the area has almost nothing to do with anything, other than the two graphs bound a specific region. The perimeter of this region isn't pertinent, nor is the area.

Here is the question you asked in the first post:
AtlasSniperma said:
How do I find the equation of a section that is the overlap of two functions? Not the area of such a section(which would be using Integral), but the equation for it.
The answer is: You don't find an equation. What you're calling the "overlap" of the two functions is an interval. I'm assuming that by "overlap" you mean the two-dimensional, finite-area region that is bounded above and below by the two curves. Again, the interval is NOT an equation; it's an inequality, with a left endpoint and a right endpoint, like what I wrote above.

I've tried clarifying, a couple times!
I want the equation/function to give the perimeter points of an area that is the overlap of two functions. I really don't want to quote myself as I have repeated a list of outputs and you have even quoted said list.

As for "This doesn't make sense. A function has to have one output, not two. That's in the basic definition of a function."
(y-3)2=x
y2+x2=12

Last edited:
Mark44
Mentor
I've tried clarifying, a couple times!
I want the equation/function to give the perimeter points of an area that is the overlap of two functions. I really don't want to quote myself as I have repeated a list of outputs and you have even quoted said list.
There are an infinite number of points on the perimeter of the region we're talking about.

Your clarification in post 7 was anything but clear. One of the examples you gave was "f(1.5)=1.25 or 2.75". This makes no sense. A function has to have a single output, not two (or more).
AtlasSniperma said:
As for "This doesn't make sense. A function has to have one output, not two. That's in the basic definition of a function."
(y-3)2=x
The graph of this relation does not represent a function (assuming that the x and y axes are in the usual places). For a given x value, there are two y values paired with it. That's not a function.

The graph of this relation does not represent a function (assuming that the x and y axes are in the usual places). For a given x value, there are two y values paired with it. That's not a function.
Thank you for explaining to me the definition of "function" that you are working with. Whereas I was raised/taught with what you call a "relation" being called a "function". Now, given we've gotten past this hurdle, do you understand my question or not?

And there is not an infinite number of points on the perimeter of this region. The perimeter of a region that is the overlap of two 'equations' is by definition the values returned by the two 'equations'.

I already told you this could be done easily. If you answer the question I asked, I can give you a simple code that will do it...

I already told you this could be done easily. If you answer the question I asked, I can give you a simple code that will do it...
Sure, I apologise, i mean to return both values at once :D

Sure, I apologise, i mean to return both values at once :D
No worries. It is easy to do what you want with a computer. Here is an example I made in MATLAB. I have shown the code which produces the values, how it is called and a plot made from the function.

Mark44
Mentor
And there is not an infinite number of points on the perimeter of this region. The perimeter of a region that is the overlap of two 'equations' is by definition the values returned by the two 'equations'.
I disagree. I don't think you understand the definition of the word "perimeter" or the fact that any line segment or curve is made up of an infinite number of points.

The perimeter of a region of overlap consists of an infinite number of points. See the graph that mfig posted, labeled Fig 1. The curve that makes up the upper boundary consists of an infinite number of points. The curve that makes up the lower boundary also consists of an infinite number of points. An equation doesn't return values other than true or false. The equation is "true" some pair of numbers (x, y) makes it a true statement.

In the matlab code that mfig posted, he's setting idx to an inequality of the form $A \le x \le B$ (in his code values for A and B are stated, and the inequality takes the form $A < x \text{ and } B > x$, with A and B the constants he wrote). His version and mine are equivalent -- we're saying the same thing.

I said this twice before, so this makes the third time. To find the region of overlap, you need an inequality, which gives you the interval. For each x value in this interval, the graph of one of the functions lies above the graph of the other, so the two graphs form the upper and lower boundaries for a close region. Outside that interval the graphs don't overlap, at least in the sense that they enclose a bounded region.

Last edited:
Sure, the line is an infinite number of points. but in the case of
y=f(x) there is only a finite number of options for y.

for f(x) where x=2 in the example equations I gave, y can ONLY be 1 and 4. not 1,1.00000000001,1.00000000002, etc. because 1.00000000001 and 1.00000000002 are part of the area not the perimeter.

Mark44
Mentor
Sure, the line is an infinite number of points. but in the case of
y=f(x) there is only a finite number of options for y.
For a function, there is only one option for y, for each input value x.

The matlab code that mfig showed calculates two function values for each x value within the interval: $f_1() = x^2 - 4x + 5$ and $f_2(x) = -x^2 + 6x - 4$. His code calculates the two function values at x values in the interval $\frac{5 - \sqrt{7}}{2} < x < \frac{5 + \sqrt{7}}{2}$, an interval that he had to use algebra to get.

mfig's matlab code calculated a bunch of points on each graph, above this interval, and graphed them to get Fig 1.

In answer to the question you asked in the first post, there is no equation that represents the two-dimensional bounded region where the two parabolas overlap.

AtlasSniperma said:
for f(x) where x=2 in the example equations I gave, y can ONLY be 1 and 4. not 1,1.00000000001,1.00000000002, etc. because 1.00000000001 and 1.00000000002 are part of the area not the perimeter.