# Integral of a real power of a quadratic polynomial

I am trying to do the following definite integral:

Integrate[(a x^2 + b x + c)^k, {x, 0, 1}]


where $a,b,c,k \in \mathbb{R}$

Now, the problem is Mathematica takes forever to produce a result which I understand is happening because of some complicated simplification procedure.

Note that the indefinite integral is done in a flash:

Integrate[(a x^2 + b x + c)^k, x]


(2^(-1 + k) (b - Sqrt[b^2 - 4 a c] + 2 a x) (( b + Sqrt[b^2 - 4 a c] + 2 a x)/Sqrt[ b^2 - 4 a c])^-k (c + x (b + a x))^k Hypergeometric2F1[-k, 1 + k, 2 + k, (-b + Sqrt[b^2 - 4 a c] - 2 a x)/( 2 Sqrt[b^2 - 4 a c])])/(a (1 + k))

After which the following:

(% /. x -> 1 - % /. x -> 0) //PowerExpand //Simplify


does give a result, but its overly complicated and I think it can be simplified further. The reason I think so is that I have not been able to exhaust the simplification situation with say FullSimplify, that is taking forever to return a result.

Can anyone suggest any workaround here?

Edit 1:

I made a simple mistake by not putting some brackets.

((% /. x -> 1) - (% /. x -> 0)) //PowerExpand //FullSimplify


does work now.

However, I am still curious why the definite integral doesn't work in the first place. Thoughts and comments will be appreciated.

Edit 2:

Given that my original problem is solved, I would like to ask another related question. What if I wanted to do the 2-variable generalization of the same:

Integrate[(a*x^2 + b*y^2 + c x y + d x + f y + g)^k, {x, 0, 1}, {y, 0,
1}, Assumptions -> (a*x^2 + b*y^2 + c x y + d x + f y +
g) \[Element] Reals && Im[b] == 0 && Im[a] == 0 && Im[c] == 0 &&
Im[d] == 0 && Im[f] == 0 && Im[g] == 0 && Im[k] == 0]


After a while, Mathematica returns the input back. Can this be done analytically, at all?

• you should add some brackets (% /. x -> 1) - (% /. x -> 0) // PowerExpand // Simplify – Ulrich Neumann Jun 9 '18 at 14:09
• @UlrichNeumann Yeah you are right! – Subho Jun 9 '18 at 14:10
• Try: Integrate[(a*x^2 + b*x + c)^k, {x, 0, 1}, Assumptions -> {a > 0, b > 0, c > 0, k > 0, k \[Element] Integers}] – Mariusz Iwaniuk Jun 9 '18 at 16:19
• Unless k is a positive integer, your integrand will have singularities at the zeros of your quadratic. Those potentially make direct evaluation from the indefinite integral unreliable. I believe that Mathematica's difficulty here lies in the difficulty of avoiding trouble with singularities. – John Doty Jun 10 '18 at 9:23

Help Integrate and it will be faster by powers of ten.

The decicive hint here is Assumptions -> (a*x^2 + b*x + c) \[Element] Reals . I think this helps a lot in internal dealing with powers of k.

Further, restriction to k > 0 is faster than for real k.

(dint01[a_, b_, c_, k_] =
Integrate[(a*x^2 + b*x + c)^k, {x, 0, 1},
Assumptions -> (a*x^2 + b*x + c) \[Element] Reals && Im[b] == 0 &&
Im[a] == 0 && Im[c] == 0 && k > 0]); // Timing

(*   {13.485, Null}   *)

(dint02[a_, b_, c_, k_] =
Integrate[(a*x^2 + b*x + c)^k, {x, 0, 1},
Assumptions -> (a*x^2 + b*x + c) \[Element] Reals && Im[b] == 0 &&
Im[a] == 0 && Im[c] == 0 && Im[k] == 0]); // Timing

(*   {33.828, Null}   *)


In both cases you get the same result, but with more restrictions for dint01[a,b,c,k] .

dint02[a, b, c, k]

(*   ConditionalExpression[(1/(a (1 + k)))
2^(-1 + k) (1 + b/Sqrt[b^2 - 4 a c])^-k ((
2 a + b + Sqrt[b^2 - 4 a c])/Sqrt[
b^2 - 4 a c])^-k (c^
k (-b + Sqrt[b^2 - 4 a c]) ((2 a + b + Sqrt[b^2 - 4 a c])/Sqrt[
b^2 - 4 a c])^
k Hypergeometric2F1[-k, 1 + k, 2 + k,
1/2 - b/(2 Sqrt[b^2 - 4 a c])] - (a + b + c)^
k (1 + b/Sqrt[b^2 - 4 a c])^
k (-2 a - b + Sqrt[b^2 - 4 a c]) Hypergeometric2F1[-k, 1 + k,
2 + k, (-2 a - b + Sqrt[b^2 - 4 a c])/(
2 Sqrt[b^2 - 4 a c])]),

(Re[(b + Sqrt[b^2 - 4 a c])/a] >= 0 ||
2 + Re[(b + Sqrt[b^2 - 4 a c])/a] <= 0 ||
(b + Sqrt[b^2 - 4 a c])/a \[NotElement] Reals) && (Re[(-b + Sqrt[b^2 - 4 a c])/a] == 0 ||
Re[(b - Sqrt[b^2 - 4 a c])/a] >= 0 ||
(Re[(-b + Sqrt[b^2 - 4 a c])/a] >= 2 &&
2 + Re[(b - Sqrt[b^2 - 4 a c])/a] <= 0) ||
(b - Sqrt[b^2 - 4 a c])/a \[NotElement] Reals)]   *)

• Please check the updated question. – Subho Jun 10 '18 at 13:42
• @Subho95 . In the future avoid shifting the goalpost. People feel frustrated to contribute effort to a specific question to then receive new requests not mentioned in the original question. You make the work others have done on your behalf seem irrelevant. Mma.SE is not a private consulting service but a public Q&A forum. Please, out of respect to the people trying to help you, either ask the question you need to ask properly the first time, or ask a new question, including you coded equations properly formatted. Cheers! – Mariusz Iwaniuk Jun 10 '18 at 14:30
• @MariuszIwaniuk I have accepted the answer and acknowledged the help. This was just a follow up question, that is very much related and I thought would find a place in this post just as well. It's not mandatory for the original answerer to answer back but would be nice as he/she is already acquainted with the question. – Subho Jun 10 '18 at 14:37