I am interested in the convolution of a triangle function of width 2d with a cosine function (it has a useful analogy with a physics problem).

I think I should be able to break the problem down using the following:

  • triangle function of width $2d$ is two convolved box-cars of width $d$
  • a box-car is two Heaviside functions (one positive, one negative... I think)
  • derivative of Heaviside function H: $\partial H = \delta$
  • for any convolution $\partial f * g = f*\partial g$
  • $\partial (f*g) = \partial f *\partial g$ (I think)
  • $\delta*-\delta = 0$ (I think)

The general idea is to convert a triangle function into an equivalent set of convolved Heaviside functions with some offsets, then take the derivative and convolve a bunch of dirac delta functions with the sinusoid.

Therefore, for triangle function $T$, box-cars $B$:

$T(x)*\cos = T(x)*\partial(\sin(x))\\ = (B(x-d/2)*B(x+d/2))*\partial(\sin)\\ = ((H(x-d)-H(x))*(H(x)-H(x+d)))*\partial(\sin)\\ = \partial\big[(H(x-d)-H(x))*(H(x)-H(x+d))\big]*\sin\\ = \big[(\delta(x-d)-\delta(x))*(\delta(x)-\delta(x+d))\big]*\sin\\ = 0*\sin(x)$

Clearly, that is hilariously wrong. This convolution does not generally self-cancel.

I'm sure there is a nice analytical expression here, but I am not sure how to proceed.

PS. For future readers, the flaw is using $\partial (f*g) = \partial f *\partial g$. Differentiation is not distributive across convolution. Error thus propagates from line 4.


There are a couple of mistakes in your derivation. First, if $$B(x-d/2)=H(x)-H(x-d),$$ then $$B(x+d/2)=H(x+d)-H(x).$$ Second, $\partial(f*g)=\partial(f)*g$. On the other hand, in the second last step, you used $\partial(f*g) = \partial(f)*\partial(g)$. Correcting them might help.

| cite | improve this answer | |
  • $\begingroup$ Heaviside conversion had a typo. thanks! Those lines now agree with my final answer. However, I did not state $\partial(f*g)=\partial(f)*g$, I stated $\partial(f*g)=\partial f*\partial g$, so I think that bit is okay, unless the derivative is not actually distributive. $\endgroup$ – Mark_Anderson Aug 4 '17 at 18:22
  • $\begingroup$ @Mark_Anderson Check math.stackexchange.com/questions/177239/… for the derivative of convolution. $\endgroup$ – Math Lover Aug 4 '17 at 18:25
  • $\begingroup$ Cool, so the derivative is not distributive across convolution. Thanks for the correction. $\endgroup$ – Mark_Anderson Aug 4 '17 at 19:27

Here is a valid derivation. Matches the numerical solution in MATLAB, although off by a constant scaling factor.

Taking a triangle from 0 to 2d.

$T(x)*\cos(x) = T(x)*\partial(\sin(x))\\ = \partial(T)*\sin(x)\\ = (B(d/2)-B(3d/2))*\sin(x)\\ = (B(d/2)-B(3d/2))*\partial(-\cos(x))\\ = \partial \big[ B(d/2)-B(3d/2) \big]*-\cos(x)\\ = \big[ \delta(x) - 2\delta(x-d) + \delta(x-2d) \big]*-\cos(x)\\ = -\cos(x) + 2 \cos(x - d) - \cos(x - 2d)$

Generalising to an input $A k\cos(kx)$ [weird I know, but that's my actual physics equation] I get the result

$T(x)*\cos = \frac{A}{k}\bigg(-\cos(x) + 2 \cos(x - d) - \cos(x - 2d)\bigg)$

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.