# How to using the method of undetermined coefficients in this equation?

I want to find the rational numbers $$a$$, $$b$$, $$c$$ satisfying the condition

$$\displaystyle \int _ { 5 } ^ { 21 } \frac { \mathrm { d } x } { x \cdot \sqrt { x + 4 } } = a \ln 3 + b \ln 5 + c \ln 7.$$ I solve by hand.

Integrate[1/(x Sqrt[x + 4]), {x, 5, 21}]


1/2 Log[15/7]

From here, I got, $$a = \dfrac{1}{2}$$, $$b = \dfrac{1}{2}$$, $$c = -\dfrac{1}{2} .$$

How can I tell Mathematica to do that?

With Maple, I got the answer directly

• You're just calculating the integral rather than solving the equation in Maple. If such results are desired for you, simply Integrate[1/(x Sqrt[x + 4]), {x, 5, 21}] // PowerExpand // Expand. – xzczd Feb 12 at 8:46
• Thank you very much. – minhthien_2016 Feb 12 at 8:52

## 3 Answers

{a/d, b/e, c/f} /.
FindInstance[Integrate[1/(x Sqrt[x + 4]), {x, 5, 21}] ==
a Log[3]/d + b Log[5]/e + c Log[7]/f, {a, b, c, d, e, f}, Integers]


{{1/2, 1/2, -(1/2)}}

• How about equation? I don't get the result? Clear[a, b, c, d, e, f] {a/d, b/e} /. FindInstance[ Integrate[1/(x Sqrt[x + 16]), {x, 9, 33}] == a Log[3]/d + b Log[11]/e, {a, d, b, e}, Integers] – minhthien_2016 Feb 12 at 8:01
• @minhthien_2016, as the message says, The methods available to FindInstance are insufficient to find the requested instances or prove they do not exist. You can try Reduce: for example, Reduce[{Integrate[1/(x Sqrt[x + 16]), {x, 9, 33}] == a Log[3]/d + b Log[11]/e, And @@ Thread[-5 <= {a, d, b, e} <= 5]}, {a, d, b, e}, Integers] gives a solution. – kglr Feb 12 at 8:23
• 1/4 Log[27/11] can be written 3/4 Log[3] - 1/4 Log[11] – minhthien_2016 Feb 12 at 8:32

Not as automated as kglr's solution, but the following works:

eq = Integrate[1/(x Sqrt[x + 4]), {x, 5, 21}] == a Log@3 + b Log@5 + c Log@7
(* 1/2 Log[15/7] == a Log[3] + b Log[5] + c Log[7] *)

PowerExpand@eq
(* 1/2 (Log[3] + Log[5] - Log[7]) == a Log[3] + b Log[5] + c Log[7] *)

Collect[Subtract @@ %, Log[_]] == 0
(* (1/2 - a) Log[3] + (1/2 - b) Log[5] + (-(1/2) - c) Log[7] == 0 *)

Cases[%, coe_ Log[_] :> Solve[coe == 0], Infinity] // Flatten
(* {a -> 1/2, b -> 1/2, c -> -(1/2)} *)


This method also handles the new added example Integrate[1/(x Sqrt[x + 16]), {x, 9, 33}] == a Log[3] + b Log[11].

• When I tried eq1 = Integrate[1/(x Sqrt[x + 16]), {x, 9, 33}] == a Log@3 + b Log@5; PowerExpand@eq1; Collect[Subtract @@ %, Log[_]] == 0; Cases[%, coe_ Log[_] :> Solve[coe == 0], Infinity] // Flatten I got {a -> 3/4, b -> 0}. I think, It is wrong. – minhthien_2016 Feb 12 at 9:02
• @minhthien_2016 The equation itself is wrong. The Log@5 should be Log@11. – xzczd Feb 12 at 9:08
• Yes. I think, the answer, It can not be found. – minhthien_2016 Feb 12 at 9:09
• As already mentioned, this solution is not a fully automated solution, error handling should be done manually. – xzczd Feb 12 at 9:13
• I am looking forward to a genenral method. – minhthien_2016 Feb 12 at 9:14

I am interpreting your question to mean that you want logarithms of rational numbers to be expressed purely in terms of logarithms of primes. If so, one can use a replacement rule:

{Integrate[1/(x Sqrt[x + 4]), {x, 5, 21}],
Integrate[1/(x Sqrt[x + 16]), {x, 9, 33}]} // Simplify
{1/2 Log[15/7], 1/4 Log[27/11]}

% /. Log[r_Rational] :> (Total[#2 Log[#1] & @@@ FactorInteger[Numerator[r]]] -
Total[#2 Log[#1] & @@@ FactorInteger[Denominator[r]]]) // Expand
{Log[3]/2 + Log[5]/2 - Log[7]/2, 3 Log[3]/4 - Log[11]/4}


Alternatively, one can use FindIntegerNullVector[], similar to what was done in this answer:

-Rest[#]/First[#] &[FindIntegerNullVector[{1/2 Log[15/7], Log[3], Log[5], Log[7]}]]
{1/2, 1/2, -1/2}

-Rest[#]/First[#] &[FindIntegerNullVector[{1/4 Log[27/11], Log[3], Log[11]}]]
{3/4, -1/4}