I would like to integrate the following function with respect to $x$. This is for a signal processing project.

$y = \cos(x + ay -a), \ -1 < a < 1$

so the function would pass the vertical line test.

Is it possible to integrate this type of function? I tried an integral calculator, but functions containing $y$ in them are not an acceptable input.

  • $\begingroup$ Sure; the answer is a function of $y$. $\endgroup$ – Matthew Leingang Sep 10 at 0:26
  • $\begingroup$ Are the $y$ on the left-hand side and the $y$ on the right-hand side the same $y$? If yes, then to maintain equality you must integrate both sides with respect to $x$. You have implicitly made $y$ dependent on $x$, so the integral on the left is not trivial. $\endgroup$ – Eric Towers Sep 10 at 0:30
  • $\begingroup$ @Matthew If you know how to integrate this function, help would be appreciated. I’m not even sure what this type of integration is called... $\endgroup$ – Auggie Sep 10 at 0:33
  • $\begingroup$ @Eric Yes, it’s the same y. The graph looks like a tilted sine wave. $\endgroup$ – Auggie Sep 10 at 0:36
  • $\begingroup$ Not sure if this is useful, but if you calculate the first and second derivatives with respect to $x$, you can find that your function $y$ satisfies the differential equation $$y'' = - y (1 + ay')^3.$$ $\endgroup$ – Daniel Sep 10 at 0:55

It is possible to compute $\displaystyle \int ydx$ as a purely algebraic function of $y$.

Rearrange to $\displaystyle x = \arccos y -ay + a$ (please take care of the domain-range considerations yourself, if they are a concern).

You can compute $\displaystyle \int xdy$ to be $\displaystyle y\arccos y - \sqrt{1-y^2} - \frac 12 ay^2 + ay + c_1$

You can assume (or show, using integration by parts) that $\displaystyle \int ydx + \int xdy = xy + c_2$

which allows you to write:

$\displaystyle \int ydx = xy - \int xdy + c_2$

$\displaystyle \int ydx = y\arccos y - ay^2 + ay - (y\arccos y - \sqrt{1-y^2} - \frac 12 ay^2 + ay + c_1) + c_2$

$\displaystyle \int ydx = \sqrt{1-y^2} -\frac 12 ay^2 + c$

which is an unexpectedly elegant result.

It does not look trivial to express that purely in terms of $x$ because of the implicit relationship between $y$ and $x$. I hope you can work with this.

Just wanted to add a cautionary note, be careful when computing definite integrals using this relationship . Remember that the integral on the LHS is wrt $x$ but the expression on the RHS involves only $y$. So let's say you wanted a lower bound of $x=0$. This will correspond to $y= 1$, so the value of the integral at the lower bound will be $\displaystyle -\frac 12a + c$. That's the value that will be subtracted off as the lower bound when you work out a definite integral. So $\displaystyle \int_0^X ydx = \sqrt{1-Y^2}-\frac12aY^2+\frac 12a$, where $y=Y$ when $x=X$ by your functional definition. Of course the constant $c$ gets cancelled out.

  • $\begingroup$ This should work perfectly for my computational needs. Thank you so much! $\endgroup$ – Auggie Sep 10 at 8:12
  • $\begingroup$ @Auggie Most welcome. :) $\endgroup$ – Deepak Sep 10 at 8:23
  • $\begingroup$ @Auggie I've made an edit to my answer urging caution when computing definite integrals. $\endgroup$ – Deepak Sep 11 at 8:31
  • 1
    $\begingroup$ Thank you for that clarification! This is very helpful, particularly because the definite integral I need to compute is indeed from 0 to the variable. $\endgroup$ – Auggie Sep 11 at 22:50
  • $\begingroup$ That's great! Unfortunately apart from $0$, other values of $X$ may require you to solve your functional equation through numerical methods (like Newton-Raphson) since your implicit functional definition is a transcendental equation and not amenable to an exact solution. But once you solve to get that value of $Y$, you can immediately (and exactly) plug it into the integral expression! :) $\endgroup$ – Deepak Sep 11 at 23:43

The effect of replacing $x$ in $\cos x$ with $x + a y - a$ is a shear. In particular, this shear can be represented by the (homogeneous matrix) $$ M = \begin{pmatrix} 1 & a & -a \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix} $$ since $$ \begin{pmatrix} \tilde{x} \\ \tilde{y} \\ 1 \end{pmatrix} = M \cdot \begin{pmatrix} x \\ y \\ 1 \end{pmatrix} = \begin{pmatrix} x + ay - a \\ y \\ 1\end{pmatrix} $$ That is, given coordinates $(x,y)$ of a point of the graph of $y = \cos x$, its image under the shear gives the coordinates $(\tilde{x}, \tilde{y})$ of a point on the graph $\tilde{y} = \cos(\tilde{x}+a\tilde{y}-a)$.

This matrix applies a linear map. The effect of a linear map on area is given by its determinant -- if the determinant is, say, $2$, the map doubles areas. So we compute the determinant of our map. Using he first column for expansion by minors should minimize computation. We find $$ \det M = 1 \begin{vmatrix} 1 & 0 \\ 0 & 1 \end{vmatrix} + 0 \cdot | \dots | + 0 \cdot | \dots | = 1 \text{.} $$ This says that areas are unchanged when we apply this shear. Therefore, we only need to be able to integrate the unsheared cosine, but with (reverse) sheared bounds of integration. A picture might help.

Here's a plot of $y = \cos(x + ay - a)$ with $a = 1/2$.

sheared with a = 1/2

Say we want the integral from $1$ to $4$. The left and right edges of the area we want are vertical on this graph.

Mathematica graphics

But on the unsheared graph, they are not.

Mathematica graphics

The resulting area is a triangular region on the left, a usual integral between the points where the bounds meet the unsheared cosine graph, plus a traingular region on the right. (Notice that the left triangular region is negative if the point where it meets $\cos x$ has negative height. Similarly, for the right endpoint if that line meets cosine at positive height.)

So you integrate this by finding where the unsheared bounds meet the unmodified cosine graph, computing the usual integral between those bounds, then correcting by these two triangle areas.

  • $\begingroup$ I had to accept the answer that best suits my needs for the project I’m working on, but your answer is greatly appreciated! I certainly learned something new from it. $\endgroup$ – Auggie Sep 10 at 8:24

I think this is non-rigorous, but might be made rigorous. Let us calculate the first and second derivatives with respect to $x$. We have $$ y' = - \sin (x +ay - a) \cdot (1 + ay') $$ and also \begin{align*} y'' &= - \cos (x + ay - a) \cdot (1 + ay')^2 + a y'' (- \sin (x +ay - a)) \\ &= -y (1 + ay')^2 + a y'' \cdot \frac{y'}{1 + ay'} \end{align*} Multiplying by $1 + ay'$ and cancelling $ay'y''$ on both sides we get: $$ y'' = - y (1 + ay')^3, $$ as I mentioned in the comments. Now, let us try to integrate $y$ with respect to $x$. Notice that $$ \frac{d}{dx} (1 + ay')^{-2} = (-2) (1 + ay')^{-3} \cdot ay''. $$ Thus, we have $$ \int y\ dx = \int - \frac{y''}{(1 + ay')^3} \ dx = \frac{1}{2a} \int \frac{d}{dx} (1 + ay')^{-2} \ dx = \frac{1}{2a(1 + ay')^2}. $$

  • 1
    $\begingroup$ Very interesting solution, thank you! I had to accept the answer that best suits my needs for the project I’m working on, but it’s good to know that differentiation can be used as a tool to help with integration. Learning new stuff every day! $\endgroup$ – Auggie Sep 10 at 8:59

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.