# Finding simplifying substitutions for an integral involving limits and integrand

[The following is based on a William Lowell Putnam Mathematical Competition problem.]

Consider the definite integral:

$I = \int\limits_2^4 \frac{\sqrt{\log (9-x)}}{\sqrt{\log (9-x)}+\sqrt{\log (x+3)}} \, dx$

Mathematica's numerical integration yields the answer directly:

NIntegrate[Sqrt[Log[9 - x]]/(Sqrt[Log[9 - x]] + Sqrt[Log[x + 3]]), {x, 2, 4}]


(* 1. *)

However, the symbolic integration does not:

Integrate[Sqrt[Log[9 - x]]/(Sqrt[Log[9 - x]] + Sqrt[Log[x + 3]]), {x, 2, 4}]


Note, though, that with the proper substitution, the integral can be solved symbolically. As the integration variable $x$ goes from $2 \rightarrow 4$, then the term $9 - x$ goes $7 \rightarrow 5$ and the term $x + 3$ goes $5 \rightarrow 7$. This symmetry suggests the substitution $x = 6 - y$ and reversing the limits of integration. This substitution gives the integral:

$I = \int\limits_2^4 {\sqrt{\log (y+3)} \over \sqrt{\log (y+3)} + \sqrt{\log (9-y)}} dy$

and so:

$2I = \int\limits_2^4 {\sqrt{\log (x+3)} + \sqrt{\log (9-x)} \over \sqrt{\log (x + 3)} + \sqrt{\log (9 - x)}} dx = \int\limits_2^4 dx = 2$

and thus $I = 1$.

Mathematica would have to be quite "clever" in finding the symmetry of the integrand given the integral's limits and performing the substitutions.

## Question:

Is there any general approach (with FullSimplify, for instance) in which Mathematica could solve this integral symbolically?

If you guess the symmetry around x == 3, a simple approach is

integrand[x_] =
Sqrt[Log[9 - x]]/(Sqrt[Log[9 - x]] + Sqrt[Log[x + 3]]);

Integrate[integrand[3 - y] + integrand[3 + y], {y, 0, 1}]

(*   1   *)


This is clear, because

integrand[3 - x] + integrand[3 + x] // Simplify

(*   1   *)


A general approach is with Series.

ser = Series[integrand[x], {x, 3, 4}] // Normal

(*   1/2 - (-3 + x)/(24 Log[6]) +
((-3 + x)^3 (-3 - 6 Log[6] - 4 Log[6]^2))/(10368 Log[6]^3)   *)


Since you get only series coefficients with odd powers of (x-3), these all vanish.

Integrate[ser, {x, 2, 4}]

(*   1   *)


This problem has a one-line solution

Integrate[Sqrt[Log[9 - x]]/(Sqrt[Log[9 - x]] + Sqrt[Log[x + 3]]) /. {x -> y + 3}, {y, -1, 1}]
(* 1 *)


One just needs to hint MA about a symmetric form of the integral.

From my answer to Integration Help :

ClearAll[symmetrizeIntegrate];
SetAttributes[symmetrizeIntegrate, HoldAll];
symmetrizeIntegrate[Integrate[f_, {x_, a_, b_}, opts___]] :=
Integrate[(f + (f /. x -> a + b - x))/2, {x, a, b}, opts]

Integrate[
Sqrt[Log[9 - x]]/(Sqrt[Log[9 - x]] + Sqrt[Log[x + 3]]),
{x, 2, 4}] // symmetrizeIntegrate
(*  1  *)