Here, we show you a step-by-step solved example of weierstrass substitution. This solution was automatically generated by our smart calculator:
We can solve the integral $\int\frac{1}{1-\cos\left(x\right)+\sin\left(x\right)}dx$ by applying the method Weierstrass substitution (also known as tangent half-angle substitution) which converts an integral of trigonometric functions into a rational function of $t$ by setting the substitution
Hence
Substituting in the original integral we get
Apply the formula: $\frac{a}{b}\frac{c}{f}$$=\frac{ac}{bf}$, where $a=1$, $b=1-\frac{1-t^{2}}{1+t^{2}}+\frac{2t}{1+t^{2}}$, $c=2$, $a/b=\frac{1}{1-\frac{1-t^{2}}{1+t^{2}}+\frac{2t}{1+t^{2}}}$, $f=1+t^{2}$, $c/f=\frac{2}{1+t^{2}}$ and $a/bc/f=\frac{1}{1-\frac{1-t^{2}}{1+t^{2}}+\frac{2t}{1+t^{2}}}\frac{2}{1+t^{2}}$
Apply the formula: $-\frac{b}{c}$$=\frac{expand\left(-b\right)}{c}$, where $b=1-t^{2}$ and $c=1+t^{2}$
Apply the formula: $\frac{a}{b}+\frac{c}{b}$$=\frac{a+c}{b}$, where $a=-1+t^{2}$, $b=1+t^{2}$ and $c=2t$
Apply the formula: $a+\frac{b}{c}$$=\frac{b+ac}{c}$, where $a=1$, $b=-1+t^{2}+2t$, $c=1+t^{2}$, $a+b/c=1+\frac{-1+t^{2}+2t}{1+t^{2}}$ and $b/c=\frac{-1+t^{2}+2t}{1+t^{2}}$
Apply the formula: $\frac{a}{\frac{b}{c}}$$=\frac{ac}{b}$, where $a=2$, $b=2t^{2}+2t$, $c=1+t^{2}$, $a/b/c=\frac{2}{\frac{2t^{2}+2t}{1+t^{2}}\left(1+t^{2}\right)}$ and $b/c=\frac{2t^{2}+2t}{1+t^{2}}$
Apply the formula: $\frac{a}{a}$$=1$, where $a=1+t^{2}$ and $a/a=\frac{2\left(1+t^{2}\right)}{\left(2t^{2}+2t\right)\left(1+t^{2}\right)}$
Factor the denominator by $2$
Cancel the fraction's common factor $2$
Simplifying
Factor the polynomial $t^{2}+t$ by it's greatest common factor (GCF): $t$
Rewrite the expression $\frac{1}{t^{2}+t}$ inside the integral in factored form
Rewrite the fraction $\frac{1}{t\left(t+1\right)}$ in $2$ simpler fractions using partial fraction decomposition
Find the values for the unknown coefficients: $A, B$. The first step is to multiply both sides of the equation from the previous step by $t\left(t+1\right)$
Multiplying polynomials
Simplifying
Assigning values to $t$ we obtain the following system of equations
Proceed to solve the system of linear equations
Rewrite as a coefficient matrix
Reducing the original matrix to a identity matrix using Gaussian Elimination
The integral of $\frac{1}{t\left(t+1\right)}$ in decomposed fractions equals
Rewrite the fraction $\frac{1}{t\left(t+1\right)}$ in $2$ simpler fractions using partial fraction decomposition
Expand the integral $\int\left(\frac{1}{t}+\frac{-1}{t+1}\right)dt$ into $2$ integrals using the sum rule for integrals, to then solve each integral separately
We can solve the integral $\int\frac{-1}{t+1}dt$ by applying integration by substitution method (also called U-Substitution). First, we must identify a section within the integral with a new variable (let's call it $u$), which when substituted makes the integral easier. We see that $t+1$ it's a good candidate for substitution. Let's define a variable $u$ and assign it to the choosen part
Differentiate both sides of the equation $u=t+1$
Find the derivative
The derivative of a sum of two or more functions is the sum of the derivatives of each function
Now, in order to rewrite $dt$ in terms of $du$, we need to find the derivative of $u$. We need to calculate $du$, we can do that by deriving the equation above
Substituting $u$ and $dt$ in the integral and simplify
Apply the formula: $\int\frac{n}{x}dx$$=n\ln\left(x\right)+C$, where $x=t$ and $n=1$
The integral $\int\frac{1}{t}dt$ results in: $\ln\left(t\right)$
Apply the formula: $\int\frac{n}{x}dx$$=n\ln\left(x\right)+C$, where $x=u$ and $n=-1$
Replace $u$ with the value that we assigned to it in the beginning: $t+1$
The integral $\int\frac{-1}{u}du$ results in: $-\ln\left(t+1\right)$
Gather the results of all integrals
Replace $t$ with the value that we assigned to it in the beginning: $\tan\left(\frac{x}{2}\right)$
As the integral that we are solving is an indefinite integral, when we finish integrating we must add the constant of integration $C$
Access detailed step by step solutions to thousands of problems, growing every day!