Question

# Integrate the following: $\int{x{{\tan }^{2}}xdx}$.

Hint:Use Integration by parts rule by taking x as first function and ${{\tan }^{2}}x$ as second function. Use $\int{{{\tan }^{2}}xdx}=\tan x-x+C$. Use $\int{\tan xdx}=\ln \left| \sec x \right|+C$ and $\int{x}=\dfrac{{{x}^{2}}}{2}$.

Let I $=\int{x{{\tan }^{2}}x}$
Since ${{\tan }^{2}}x={{\sec }^{2}}x-1$, we have
\begin{align} & \text{I}=\int{x\left( {{\sec }^{2}}x-1 \right)dx} \\ & =\int{\left( x{{\sec }^{2}}xdx-x \right)dx} \\ \end{align}
We know that $\int{\left( f\left( x \right)+g\left( x \right) \right)dx}=\int{f\left( x \right)dx}+\int{g\left( x \right)dx}+C$
Using the above formula, we get
\begin{align} & \text{I=}\int{x{{\sec }^{2}}xdx}-\int{xdx} \\ & ={{\text{I}}_{1}}-{{\text{I}}_{2}} \\ \end{align}
where ${{\text{I}}_{1}}=\int{x{{\sec }^{2}}xdx}$ and ${{\text{I}}_{2}}=\int{xdx}$
Now we have
${{\text{I}}_{1}}=\int{x{{\sec }^{2}}xdx}$
Integrating by parts rule if $\int{f\left( x \right)dx}=u\left( x \right)$ and $\dfrac{d}{dx}\left( g\left( x \right) \right)=v\left( x \right)$, then $\int{f\left( x \right)g\left( x \right)dx}=g\left( x \right)u\left( x \right)-\int{u\left( x \right)v\left( x \right)dx}$
g(x) is called the first function and f(x) is called the second function.
Substituting g(x)=x and f(x) $={{\sec }^{2}}x$, we have
v(x) $=\dfrac{d}{dx}\left( x \right)=1$ and u(x) $=\int{{{\sec }^{2}}x=\tan x}$
Hence we have
$\int{x{{\sec }^{2}}x}dx=x\tan x-\int{\tan xdx}$
Now, we know that $\tan x=\dfrac{\sin x}{\cos x}$
Hence, we have
$\int{x{{\sec }^{2}}xdx}=x\tan x-\int{\dfrac{\sin x}{\cos x}dx}$
In the integral put cosx = t, we have $dt=-\sin xdx$
Hence we have
${{\text{I}}_{1}}=x\tan x+\int{\dfrac{dt}{t}}$
Now we know that $\int{\dfrac{dx}{x}=\ln \left| x \right|+C}$
Hence we have
${{\text{I}}_{1}}=x\tan x+\ln \left| t \right|+C$
Replacing the original variable, we get
${{\text{I}}_{1}}=x\tan x+\ln \left| \cos x \right|+C$
Also ${{\text{I}}_{2}}=\int{xdx}=\dfrac{{{x}^{2}}}{2}$
Hence we have
$\text{I=}x\tan x+\ln \left| \cos x \right|-\dfrac{{{x}^{2}}}{2}+C$
Note: Alternatively, we have
$\int{{{\tan }^{2}}xdx}=\int{\left( {{\sec }^{2}}x-1 \right)dx}=\int{{{\sec }^{2}}xdx}-\int{dx}=\tan x-x+C$
Now we know that
if $\int{f\left( x \right)dx}=u\left( x \right)$ and $\dfrac{d}{dx}\left( g\left( x \right) \right)=v\left( x \right)$, then $\int{f\left( x \right)g\left( x \right)dx}=g\left( x \right)u\left( x \right)-\int{u\left( x \right)v\left( x \right)dx}$
g(x) is called the first function and f(x) is called the second function.
Substituting g(x) = x and f(x) $={{\tan }^{2}}x$, we get
v(x) $=\dfrac{d}{dx}\left( x \right)=1$ and u(x) = $\int{{{\tan }^{2}}xdx}=\tan x-x$
Hence, by integration by parts rule, we have
$\int{x{{\tan }^{2}}x}=x\left( \tan x-x \right)-\int{\left( \sec x-x \right)dx}$
We know that $\int{\left( f\left( x \right)+g\left( x \right) \right)dx}=\int{f\left( x \right)dx}+\int{g\left( x \right)dx}+C$
Using the above formula, we get
\begin{align} & \int{x{{\tan }^{2}}xdx}=x\left( \tan x-x \right)-\int{\tan xdx}+\int{xdx} \\ & =x\tan x-{{x}^{2}}+\ln \left| \cos x \right|+\dfrac{{{x}^{2}}}{2}+C \\ & =x\tan x+\ln \left| \cos x \right|-\dfrac{{{x}^{2}}}{2}+C \\ \end{align}
which is the same as obtained above.
[2] Although there is no general rule in choosing the first and second functions in Integration by parts, the most common order of preference for the first function is given by ILATE rule
I = Inverse trigonometric functions
L = Logarithmic functions
A = Algebraic expressions
T = Trigonometric functions
E = Exponential functions.