Integration by parts

### 13.3.5 Integration by parts

Recall the integration by parts formula:

∫ | u(x)v′(x) dx= u(x)v(x)− | ∫ | v(x)u′(x) dx.

If you want to integrate a function f(x) by parts, you need to specify how to write f(x) as u(x)v′(x), which you can do by either specifying u(x) or v(x). The result will be in the form F(x)+∫g(x) dx, where F(x)=u(x)v(x) and g(x)=−v(x)u′(x).

In some cases, to finish an integral you need to integrate by parts more than once. After one integrating by parts once and getting F(x)+∫g(x) dx, you may have to integrate ∫g(x) dx by parts and add F(x) to the result.

Xcas has two commands for integrating by parts: ibpdv (where you specify v(x)) and ibpu (where you specify u(x)), both of which return the result as a list [F(x),g(x)]. Both of these commands allow you to keep track of the function F(x) you may need to add to the result of a subsequent integration by parts.

The ibpdv command finds the primitive of an expression written as u(x)v′(x) by specifying v(x).

- ibpdv takes two arguments:
  - uvprime, an expression which you can think of as u(x) v′(x), or [Fexpr,uvprime], a list of two expressions, where again you can think of uvprime as u(x)v′(x), and Fexpr represents the function F(x) that you can add to the result of integrating by parts.
  - vexpr, an expression you can think of as v(x). If vexpr is 0, then instead of integrating by parts, the expression uvprime is integrated as a whole (this can be useful for finishing a multi-step integration by parts problem).
- ibpdv(uvprime,vexpr) or ibpdv([Fexpr,uvprime],vexpr) returns
  - if vexpr≠ 0:

    [u(x)v(x),−v(x)u′(x)] (or [F(x)+u(x) v(x),−v(x)u′(x)] if the first argument is a list).

  - if vexpr=0:

    G(x) (or F(x)+G(x), if the first argument is a list), where G(x) is a primitive of uvprime.

Hence, ibpdv returns the terms computed in an integration by parts, with the possibility of doing several ibpdvs successively.

When the answer of

ibpdv(u(x)*v'(x),v(x))

is computed, to obtain a primitive of u(x) v′(x), it remains to compute the integral of the second term of this answer and then to sum this integral with the first term of this answer: to do this, just use ibpdv command with the answer as first argument and a new v(x) (or 0 to terminate the integration) as second argument.

The ibpu command finds the primitive of an expression written as u(x)v′(x) by specifying u(x).

- ibpu takes two arguments:
  - uvprime, an expression which you can think of as u(x) v′(x), or [Fexpr,uvprime], a list of two expressions, where again you can think of uvprime as u(x)v′(x), and Fexpr represents the function F(x) that you can add to the result of integrating by parts.
  - uexpr, an expression you can think of as u(x). If uexpr is 0, then instead of integrating by parts, the expression uvprime is integrated as a whole (this can be useful for finishing a multi-step integration by parts problem).
- ibpu(uvprime,uexpr) or ibpu([Fexpr,uvprime],uexpr) returns
  - if uexpr≠ 0:

    [u(x)v(x),−v(x)u′(x)] (or [F(x)+u(x) v(x),−v(x)u′(x)] if the first argument is a list).

  - if uexpr=0:

    G(x) (or F(x)+G(x), if the first argument is a list), where G(x) is a primitive of uvprime.

Hence, ibpu returns the terms computed in an integration by parts, with the possibility of doing several ibpus successively.

When the answer of

ibpu(u(x)*v'(x),u(x))

is computed, to obtain a primitive of u(x) v′(x), it remains to compute the integral of the second term of this answer and then to sum this integral with the first term of this answer: to do this, just use the ibpu command with the answer as first argument and a new u(x) (or 0 to terminate the integration) as second argument.

#### Example

ibpdv(ln(x),x)

| ⎡ ⎣ | x lnx,−1 | ⎤ ⎦

then:

ibpdv([x*ln(x),-1],0)

or:

ibpdv(ans(),0)

−x+x lnx |  |  |  |  |  |  |  |  |  |

When the first argument of ibpdv is a list of two elements, ibpdv works only on the last element of this list and adds the integrated term to the first element of this list. (therefore it is possible to do several ibpdvs successively).

For example, to evaluate ∫ln(x)2 dx, input:

ibpdv((ln(x))^2,x)

| ⎡ ⎣ | x ln2x,−2 lnx | ⎤ ⎦

It remains to integrate −2lnx:

ibpdv([x*(ln(x))^2,-2*log(x)],x)

or:

ibpdv(ans(),x)

| ⎡ ⎣ | x ln2x−2 x lnx,2 | ⎤ ⎦

And now it remains to integrate 2:

ibpdv([x*(ln(x))^2+x*(-2*log(x)),2],0)

or:

ibpdv(ans(),0)

x ln2x−2 x lnx+2 x |  |  |  |  |  |  |  |  |  |

ibpu(ln(x),ln(x))

| ⎡ ⎣ | x lnx,−1 | ⎤ ⎦

then:

ibpu([x*ln(x),-1],0)

or:

ibpu(ans(),0)

−x+x lnx |  |  |  |  |  |  |  |  |  |

When the first argument of ibpu is a list of two elements, ibpu works only on the last element of this list and adds the integrated term to the first element of this list. Therefore it is possible to do several ibpus successively, similarly to how you can do several ibpdvs successively.

For example, to evaluate ∫ln(x)2 dx, input:

ibpu((ln(x))^2,(ln(x))^2)

| ⎡ ⎣ | x ln2x,−2 lnx | ⎤ ⎦

It remains to integrate −2lnx:

ibpu([x*(ln(x))^2,-2*ln(x)],ln(x))

or:

ibpu(ans(),ln(x))

| ⎡ ⎣ | x ln2x−2 x lnx,2 | ⎤ ⎦

Finally, it remains to integrate 2:

ibpu([x*(ln(x))^2+x*(-2*ln(x)),2],0)

or:

ibpu(ans(),0)

x ln2x−2 x lnx+2 x |  |  |  |  |  |  |  |  |  |