Integrate $\int 2x\sin{(x^2+x)} \,dx$

169 Views Asked by At

Evaluate $\int 2x\sin{(x^2+x)} \,dx$ using integration by parts.

Let $u=2x$ and $dv=\sin(x^2+x)dx$ and I got that $du=x^2dx$. I'm stuck when integrating $\sin{(x^2+x)}$. Then I tried the integral calculator and it says:

$$-\cos(x^2+x)-\frac{\sqrt{\pi}\cos{\frac{1}{4}}S\left(\frac{\sqrt 2\left(x+\frac{1}{2}\right)}{\sqrt\pi}\right)}{\sqrt2}+\frac{\sqrt{\pi}\sin{\frac{1}{4}}C\left(\frac{\sqrt 2\left(x+\frac{1}{2}\right)}{\sqrt\pi}\right)}{\sqrt2}.$$

But I don't understand how the calculator got the answer. Maybe there's an easier method for a calculus 2 student like me.

2

There are 2 best solutions below

0
On BEST ANSWER

Took me a few tries but here goes. First off, we'll integrate $\sin(x^2 + x)$. Then we'll use that to build the original integral in question.

This one requires a trick. You will need to first "complete the square" on $x^2 + x$. Note that (this can be "reverse-engineered" from Wolfram(?)s output by noting the $x + \frac{1}{2}$ business)

$$x^2 + x = \left(x^2 + x + \frac{1}{4}\right) - \frac{1}{4} = \left(x + \frac{1}{2}\right)^2 - \frac{1}{4}$$

Now you can break up the sine by using the angle summation formula:

$$\sin(a + b) = \sin(a) \cos(b) + \cos(a) \sin(b)$$

so that

$$\begin{align} \sin(x^2 + x) &= \sin\left(\left(x + \frac{1}{2}\right)^2 - \frac{1}{4}\right)\\ &= \sin\left(\left(x + \frac{1}{2}\right)^2\right) \cos\left(-\frac{1}{4}\right) + \cos\left(\left(x + \frac{1}{2}\right)^2\right) \sin\left(-\frac{1}{4}\right)\\ &= \sin\left(\left(x + \frac{1}{2}\right)^2\right) \cos\left(\frac{1}{4}\right) - \cos\left(\left(x + \frac{1}{2}\right)^2\right) \sin\left(\frac{1}{4}\right)\end{align}$$

Yeah that looks nasty. Now it becomes two integrals:

$$\int \sin(x^2 + x)\ dx = \int \sin\left(\left(x + \frac{1}{2}\right)^2\right) \cos\left(\frac{1}{4}\right)\ dx - \int \cos\left(\left(x + \frac{1}{2}\right)^2\right) \sin\left(\frac{1}{4}\right)\ dx$$

pulling the constant stuff out front,

$$\int \sin(x^2 + x)\ dx = \cos\left(\frac{1}{4}\right) \int \sin\left(\left(x + \frac{1}{2}\right)^2\right) \ dx - \sin\left(\frac{1}{4}\right) \int \cos\left(\left(x + \frac{1}{2}\right)^2\right)\ dx$$

The real meat here, though, is now that you will need to use two functions you likely haven't seen before, called the Fresnel sine and cosine integral, which are what "$S$" and "$C$" in the given answer are. They are defined by

$$S(x) := \int_{0}^{x} \sin(\frac{1}{2}\pi x'^2)\ dx'$$ $$C(x) := \int_{0}^{x} \cos(\frac{1}{2}\pi x'^2)\ dx'$$

There is no simpler way to express these integrals - it is like the integral of $\frac{1}{x}$, which is used to define the natural logarithm, or of $\frac{1}{\sqrt{1 - x^2}}$, which defines the inverse trig. No shame in seeing something new: I remember when I first studied calculus a long, long time ago I was fascinated by the earlier versions of Wolfram's integrator and these "exotic" kinds of functions were thus something I came across relatively early.

The factors of $\frac{1}{2}\pi$ are normalization factors included to make the functions have nice limits as their input goes to infinity - sometimes, these functions are defined with these factors omitted. This gives (multiplying factors inside and out to cancel/create $du$)

$$\int \sin(x^2)\ dx = \sqrt{\frac{\pi}{2}} S\left(\sqrt{\frac{2}{\pi}} x\right)$$ $$\int \cos(x^2)\ dx = \sqrt{\frac{\pi}{2}} C\left(\sqrt{\frac{2}{\pi}} x\right)$$

so

$$\int \sin\left(\left(x + \frac{1}{2}\right)^2\right)\ dx = \sqrt{\frac{\pi}{2}} S\left(\sqrt{\frac{2}{\pi}} \left(x + \frac{1}{2}\right)\right)$$ $$\int \cos\left(\left(x + \frac{1}{2}\right)^2\right)\ dx = \sqrt{\frac{\pi}{2}} C\left(\sqrt{\frac{2}{\pi}} \left(x + \frac{1}{2}\right)\right)$$

then going back to the original expression and saving the common factor $\sqrt{\frac{\pi}{2}}$,

$$\int \sin(x^2 + x)\ dx = \sqrt{\frac{\pi}{2}} \left[\cos\left(\frac{1}{4}\right) S\left(\sqrt{\frac{2}{\pi}} \left(x + \frac{1}{2}\right)\right) - \sin\left(\frac{1}{4}\right) C\left(\sqrt{\frac{2}{\pi}} \left(x + \frac{1}{2}\right)\right)\right] + \mathrm{constant}$$

which is, essentially, what you have given in the original answer. To get the integral of

$$\int 2x\ \sin(x^2 + x)\ dx$$

first convert $2x$ by adding and subtracting $1$: $2x = (2x + 1) - 1$ and then

$$ \begin{align} \int 2x\ \sin(x^2 + x)\ dx &= \int [(2x + 1) - 1] \sin(x^2 + x)\ dx\\ &= \int (2x + 1) \sin(x^2 + x)\ dx - \int \sin(x^2 + x)\ dx \end{align}$$

The first integral is a simple $u$-substitution of $u = x^2 + x$, with $du = 2x + 1$, integrating to $-\cos(x^2 + x)$. The second is what we just did, and thus the ultimate answer is

$$\int 2x\ \sin(x^2 + x)\ dx =\\ -\cos(x^2 + x) - \sqrt{\frac{\pi}{2}} \left[\cos\left(\frac{1}{4}\right) S\left(\sqrt{\frac{2}{\pi}} \left(x + \frac{1}{2}\right)\right) - \sin\left(\frac{1}{4}\right) C\left(\sqrt{\frac{2}{\pi}} \left(x + \frac{1}{2}\right)\right)\right] + \mathrm{constant}$$

which is, up to some reformatting, exactly what you gave in your answer.

Sadly, not everything has a simple method, not in maths or in anything else. Many things just take a lot of hard slogging to get right. Efficiency is in learning to be able to strike the fine balance between spending time searching for a simpler method and abandoning that search for the direct, but ugly, guaranteed method.

For what it's worth, the $S(x)$ and $C(x)$ functions have beautiful graphs:

enter image description here

(Courtesy: https://commons.wikimedia.org/wiki/File:Fresnel_integrals.gif, author unnamed, cc-by-sa 3.0.)

0
On

The antiderivative is not an elementary function. In terms of the usual functions you know - sines, cosines, inverse trig functions, exponentials, logarithms, and algebraic functions - there is no way to write it down in a closed form. The best form we can give will still have an integral sign in it.

Those $C$ and $S$ functions the CAS gave you? Those are the Fresnel functions, themselves defined as integrals.

So no, there isn't a way you can do this as a Calculus 2 student.