# Convolution of an indicator function

## Homework Statement

Calculate f*f where f is the indicator function (-1,1)

## Homework Equations

The convolution f*g of functions f and g is defined by:

f*g(x)=$\int^{\infty}_{-\infty} f(x-y)g(y)\ dy$

## The Attempt at a Solution

I haven't really done convolution before as I am teaching myself, so I am looking for a start please.

Related Calculus and Beyond Homework Help News on Phys.org
LCKurtz
Homework Helper
Gold Member

## Homework Statement

Calculate f*f where f is the indicator function (-1,1)

## Homework Equations

The convolution f*g of functions f and g is defined by:

f*g(x)=$\int^{\infty}_{-\infty} f(x-y)g(y)\ dy$

## The Attempt at a Solution

I haven't really done convolution before as I am teaching myself, so I am looking for a start please.
Let's call your indicator function I, which is 1 on (-1,1) and zero elswhere. So you are trying to calculate

$$\int^{\infty}_{-\infty} I(x-y)I(y)\ dy =\int_{-1}^{1}I(x-y)\cdot 1\ dy$$

since I(y) is zero elsewhere. The value of this depends on where x is. For example, if x is too large, say x = 10, then when y is in (-1,1), (x-y) will never be in (-1,1) to trigger the indicator function. So carefully examine what values make it non-zero and evaluate the integral accordingly.

Let's call your indicator function I, which is 1 on (-1,1) and zero elswhere. So you are trying to calculate

$$\int^{\infty}_{-\infty} I(x-y)I(y)\ dy =\int_{-1}^{1}I(x-y)\cdot 1\ dy$$

since I(y) is zero elsewhere. The value of this depends on where x is. For example, if x is too large, say x = 10, then when y is in (-1,1), (x-y) will never be in (-1,1) to trigger the indicator function. So carefully examine what values make it non-zero.

So does x have to be between (2,-2) is that what you mean?

LCKurtz
Homework Helper
Gold Member
Let's call your indicator function I, which is 1 on (-1,1) and zero elswhere. So you are trying to calculate

$$\int^{\infty}_{-\infty} I(x-y)I(y)\ dy =\int_{-1}^{1}I(x-y)\cdot 1\ dy$$

since I(y) is zero elsewhere. The value of this depends on where x is. For example, if x is too large, say x = 10, then when y is in (-1,1), (x-y) will never be in (-1,1) to trigger the indicator function. So carefully examine what values make it non-zero and evaluate the integral accordingly.
So does x have to be between (2,-2) is that what you mean?
As you apparently have figured out, the integral will be 0 for x outside of that interval. What is it for x in that interval? You may have to look at cases.

As you apparently have figured out, the integral will be 0 for x outside of that interval. What is it for x in that interval? You may have to look at cases.
will the integral not just be 2 because the indicator function if triggered so it's the integral of 1 which is x between 1 and -1 which is 2?

LCKurtz
Homework Helper
Gold Member
will the integral not just be 2 because the indicator function if triggered so it's the integral of 1 which is x between 1 and -1 which is 2?
No. For example, suppose x = 1.9. Then if y is between -1 and 1 think about integrating I(x-y) for that x:

$$\int_{-1}^1 I(1.9 - y)\, dy$$

For most of the y in (-1,1), 1.9-y is not going to be in (-1,1) so for most of those y the indicater will be 0. But not for all those y. It depends on the value of x.

No. For example, suppose x = 1.9. Then if y is between -1 and 1 think about integrating I(x-y) for that x:

$$\int_{-1}^1 I(1.9 - y)\, dy$$

For most of the y in (-1,1), 1.9-y is not going to be in (-1,1) so for most of those y the indicater will be 0. But not for all those y. It depends on the value of x.
I understand what you mean, so I have y in (-1,1) and x in (2,-2) but I don't see a formula between the two that will make sure x-y is always in (-1,1)?

LCKurtz
Homework Helper
Gold Member
No. For example, suppose x = 1.9. Then if y is between -1 and 1 think about integrating I(x-y) for that x:

$$\int_{-1}^1 I(1.9 - y)\, dy$$

For most of the y in (-1,1), 1.9-y is not going to be in (-1,1) so for most of those y the indicater will be 0. But not for all those y. It depends on the value of x.
I understand what you mean, so I have y in (-1,1) and x in (2,-2) but I don't see a formula between the two that will make sure x-y is always in (-1,1)?
But x-y isn't always in (-1,1). Here's what you need to do. Mark off a horizontal y-axis (not x axis) between -3 and 3. Mark a point called x at about -1.5. Then highlight the interval that goes one unit each direction of your point x. These will be the points where I(x-y) = 1 as y varies from -1 to 1. So draw a graph of this I(x-y), it is one on that interval and 0 elsewhere. Now what happens if you integrate that function you have drawn from y = -1 to 1? What your picture looks like depends on where x is.

But x-y isn't always in (-1,1). Here's what you need to do. Mark off a horizontal y-axis (not x axis) between -3 and 3. Mark a point called x at about -1.5. Then highlight the interval that goes one unit each direction of your point x. These will be the points where I(x-y) = 1 as y varies from -1 to 1. So draw a graph of this I(x-y), it is one on that interval and 0 elsewhere. Now what happens if you integrate that function you have drawn from y = -1 to 1? What your picture looks like depends on where x is.
Sorry I think I am getting confused. I have done the graph like you said, so y must be between -1 and 1. So if x=-1.5 then I(x-y) = 1 for y between -0.5 and -1?

LCKurtz
Homework Helper
Gold Member
Sorry I think I am getting confused. I have done the graph like you said, so y must be between -1 and 1. So if x=-1.5 then I(x-y) = 1 for y between -0.5 and -1?
I don't want you to think x = -1.5, just be a point near there. Here's what your picture should look like:

x is an arbitrary point, and f(y) = I(x-y) is a translated indicator function that is 1 for a distance of 1 each direction from x and 0 elsewhere.

Your problem is to calculate the integral:

$$\int_{-1}^{1} I(x-y)\ dy$$

Note that f(y) is mostly zero on (-1,1) and you need to figure out the value of ? to do the integral. It depends on x. You need to see what x this picture works for and see if you need a different picture if x is farther to the right.

Last edited:
I don't want you to think x = -1.5, just be a point near there. Here's what your picture should look like:

x is an arbitrary point, and f(y) = I(x-y) is a translated indicator function that is 1 for a distance of 1 each direction from x and 0 elsewhere.

Your problem is to calculate the integral:

$$\int_{-1}^{1} I(x-y)\ dy$$

Note that f(y) is mostly zero on (-1,1) and you need to figure out the value of ? to do the integral. It depends on x. You need to see what x this picture works for and see if you need a different picture if x is farther to the right.
I think I have been a bit stupid here, there is a question before this that I think answers what you are asking. I had to measure the overlap of the intervals (-1,1) and (-1+x,1+x) for various values of x. I found that for values of x not in (-2,2) the overlap is empty and equals zero. For values of x inside (-2,2) the overlap is the intersection of the two intervals and the measure is given by 2-|x|.

Will this help me?

LCKurtz
Homework Helper
Gold Member
I think I have been a bit stupid here, there is a question before this that I think answers what you are asking. I had to measure the overlap of the intervals (-1,1) and (-1+x,1+x) for various values of x. I found that for values of x not in (-2,2) the overlap is empty and equals zero. For values of x inside (-2,2) the overlap is the intersection of the two intervals and the measure is given by 2-|x|.

Will this help me?
Yes, it will if you understand what the overlap has to do with the value of the integral. Do the integral represented by that last picture and see what you get.

Yes, it will if you understand what the overlap has to do with the value of the integral. Do the integral represented by that last picture and see what you get.
I think I understand what the overlap is. Is the overlap not the values the make the integral non-zero.

So to do the integral instead of the limits being 1 and -1 they will become -1 and ?

LCKurtz
Homework Helper
Gold Member
I think I understand what the overlap is. Is the overlap not the values the make the integral non-zero.

So to do the integral instead of the limits being 1 and -1 they will become -1 and ?
Yes. You get zero for the function on the rest of the interval don't you? You are integrating the function in the picture after all.

So, in the picture, what is ? in terms of x? Then do the integral and tell me what you get. It will be some function of x.

Once you figure that out your next problem is to figure out for what x the answer you get works. Think about sliding the picture left and right corresponding to different values of x and what it does to the limits of integration. And you should also be able to see why x outside of (-2,2) gives zero for the integral.

This forum has gotten dog-slow for some reason and keeps timing out for me. I hope they are working on that.

Yes. You get zero for the function on the rest of the interval don't you? You are integrating the function in the picture after all.

So, in the picture, what is ? in terms of x? Then do the integral and tell me what you get. It will be some function of x.

Once you figure that out your next problem is to figure out for what x the answer you get works. Think about sliding the picture left and right corresponding to different values of x and what it does to the limits of integration. And you should also be able to see why x outside of (-2,2) gives zero for the integral.

This forum has gotten dog-slow for some reason and keeps timing out for me. I hope they are working on that.
Yeah it's being very slow with me too. Erm would ?=x+1 so the integral is equal to (x+2)?

LCKurtz
Homework Helper
Gold Member
Yeah it's being very slow with me too. Erm would ?=x+1 so the integral is equal to (x+2)?
Yes, but that doesn't work for all x. Look at what happens as x moves to the right.

Yes, but that doesn't work for all x. Look at what happens as x moves to the right.
If x were to move to the right would it then be between x-1 and 1 which would then give 2-x?

Yes, but that doesn't work for all x. Look at what happens as x moves to the right.
I'm not sure but is the measure of the overlap I worked out not the answer to the integral?

So the integral will be equal to 2-|x| i.e 2+x when x is negative and 2-x when x is positive?

LCKurtz
Homework Helper
Gold Member
I'm not sure but is the measure of the overlap I worked out not the answer to the integral?

So the integral will be equal to 2-|x| i.e 2+x when x is negative and 2-x when x is positive?
At last the site seems up to speed. Yes, that is the correct answer. But did you actually work out the integrals to get the answers? Do you see why the form of the answer changes when x = 0? If the answer to both is "yes", then I guess we're done here.

At last the site seems up to speed. Yes, that is the correct answer. But did you actually work out the integrals to get the answers? Do you see why the form of the answer changes when x = 0? If the answer to both is "yes", then I guess we're done here.
Erm to be honest I just used the previous question :uhh:, I thought that was all I needed to do?

Do you mean that is it because the overlap is like a triangle function?

LCKurtz
Homework Helper
Gold Member
At last the site seems up to speed. Yes, that is the correct answer. But did you actually work out the integrals to get the answers? Do you see why the form of the answer changes when x = 0? If the answer to both is "yes", then I guess we're done here.
Erm to be honest I just used the previous question :uhh:, I thought that was all I needed to do?

Do you mean that is it because the overlap is like a triangle function?
I don't know what you mean when you say the overlap is "like a triangle function". Or earlier where you said "I'm not sure but is the measure of the overlap I worked out not the answer to the integral" what you meant by "measure of the overlap".

Perhaps you completely understand it and we are just having trouble communicating. So please answer these three questions:

1. Did you get those two functions making the triangle shape by setting up the integrals and taking antiderivatives?

2. Do you understand why you get different answers depending on whether x > 0 or x < 0 and why 0 is where it changes form?

3. Do you understand why the integral is zero when x is outside (-2,2)?

I don't know what you mean when you say the overlap is "like a triangle function". Or earlier where you said "I'm not sure but is the measure of the overlap I worked out not the answer to the integral" what you meant by "measure of the overlap".

Perhaps you completely understand it and we are just having trouble communicating. So please answer these three questions:

1. Did you get those two functions making the triangle shape by setting up the integrals and taking antiderivatives?

2. Do you understand why you get different answers depending on whether x > 0 or x < 0 and why 0 is where it changes form?

3. Do you understand why the integral is zero when x is outside (-2,2)?
1. This is the bit I'm struggling with i think?

2. I think so, is it because when x < 0 the overlap is given by 2+x and when x<0 the overlap is 2-x?

3. Because then x-y is not in (-1,1) and so the indicator function is zero and so the integral is zero

LCKurtz
Homework Helper
Gold Member
I don't want you to think x = -1.5, just be a point near there. Here's what your picture should look like:

x is an arbitrary point, and f(y) = I(x-y) is a translated indicator function that is 1 for a distance of 1 each direction from x and 0 elsewhere.

Your problem is to calculate the integral:

$$\int_{-1}^{1} I(x-y)\ dy$$

Note that f(y) is mostly zero on (-1,1) and you need to figure out the value of ? to do the integral. It depends on x. You need to see what x this picture works for and see if you need a different picture if x is farther to the right.
I don't know what you mean when you say the overlap is "like a triangle function". Or earlier where you said "I'm not sure but is the measure of the overlap I worked out not the answer to the integral" what you meant by "measure of the overlap".

Perhaps you completely understand it and we are just having trouble communicating. So please answer these three questions:

1. Did you get those two functions making the triangle shape by setting up the integrals and taking antiderivatives?

2. Do you understand why you get different answers depending on whether x > 0 or x < 0 and why 0 is where it changes form?

3. Do you understand why the integral is zero when x is outside (-2,2)?
1. This is the bit I'm struggling with i think?
Look at the above graph from an earlier post. In one of your posts you figured out that ? = x+1. So OK, what do you get if you integrate that function in that picture from -1 to 1. Actually do the integral.

2. I think so, is it because when x < 0 the overlap is given by 2+x and when x<0 the overlap is 2-x?
It isn't "overlap" we are after, it is the value of the integral. Draw another picture with x > 0 and do the corresponding integral once you figure out the interval. That is the only way you will understand where the 2+x and 2-x actually come from.

3. Because then x-y is not in (-1,1) and so the indicator function is zero and so the integral is zero
Yes for 3.

Look at the above graph from an earlier post. In one of your posts you figured out that ? = x+1. So OK, what do you get if you integrate that function in that picture from -1 to 1. Actually do the integral.

It isn't "overlap" we are after, it is the value of the integral. Draw another picture with x > 0 and do the corresponding integral once you figure out the interval. That is the only way you will understand where the 2+x and 2-x actually come from.

Yes for 3.
1. so the integral would be between -1 and x+1 of 1dy which would be (x+1)-(-1)=x+2?

2.If x>0 then the integral is between 1 and x-1 of 1dy which would be (x-1)-(1)=x-2

LCKurtz
Homework Helper
Gold Member
1. so the integral would be between -1 and x+1 of 1dy which would be (x+1)-(-1)=x+2?

2.If x>0 then the integral is between 1 and x-1 of 1dy which would be (x-1)-(1)=x-2
You have the limits reversed on the second one but other than that:

Yes!! Ta-Daaa!!

You have now successfully actually calculated a convolution integral. Now that you have done that you might enjoy an animated picture of a convolution, albeit with two different functions. But it is the same idea. The shaded area represents the value of the integral. Look here:

http://mathworld.wolfram.com/Convolution.html