# Integrating multivariable funciton

I'm new to Mathematica, and trying to plot a function, but stuck at integrating the function for hours. What I want to do is to plotting the following function with respect to $x$. $$-\int^1_0\sum^n_{i=1}{n-1\choose i-1}^2(x-y)^2(xy)^{2i-2}(1-x^2)^{n-i}(1-y^2)^{n-i}2ydy$$ To do so, I defined a function $h$ which has 4 variable

h[x_, y_, i_, n_] = -(Binomial[n - 1, i - 1])^2*((x - y)^2)*(x y)^(2 i - 2) ((1 - x^2) (1 - y^2))^(n - i) 2 y

But I can't figure out how to make a summation over $i$ and then how to integrate with respect to $y$.

What should I do if I want to do the integration and summation of this multivariable function?

• You need a space (or *) in xy. – b.gates.you.know.what Aug 28 '17 at 20:30
• I tried Sum[h[,,i,n],{i,n}], but it processed nothing.. – Andeanlll Aug 28 '17 at 20:33
• First integrating and then doing the summation returns an answer. – b.gates.you.know.what Aug 28 '17 at 20:36
• Oh my god.. Thank you so much for the help. It works!!!! By the way, I can remove the $\{x,0,1\}$ term because I integrate only w.r.t. $y$, right? – Andeanlll Aug 28 '17 at 20:37
• Thank you so much for your help. One thing I noticed is that If I run the code for $n=2$, n = 2; Integrate[Sum[h[x, y, i, n], {i, 1, n}], {y, 0, 1}], The output has $y$ inside in it. Something like $\frac{1}{6}+\cdots+x^2xy^2$. Why isn't the $y$ term integrated out? – Andeanlll Aug 28 '17 at 20:46

Consolidating comments and using assumptions and simplifications

h[x_, y_, i_,
n_] = -Binomial[n - 1, i - 1]^2*(x - y)^2*(x y)^(2 i -
2) ((1 - x^2) (1 - y^2))^(n - i) 2 y;

Integrate each term

f[x_, i_, n_] =
Assuming[Element[{i, n}, Integers] && 1 <= i <= n,
Integrate[h[x, y, i, n], {y, 0, 1}] // Simplify]

(*  -x^(2 (-1 + i)) (1 - x^2)^(-i + n)
Binomial[-1 + n, -1 +
i]^2 (-i + n)! (-((2 x Gamma[1/2 + i])/
Gamma[3/2 + n]) + ((i + (1 + n) x^2) Gamma[i])/Gamma[2 + n])  *)

Sum the integrals

g[x_, n_] =
Assuming[Element[n, Integers] && n >= 1,
Sum[f[x, i, n], {i, n}] // FullSimplify]

(*  -((1 + 2 n x^2)/(n + n^2)) +
1/Gamma[3/2 + n] Sqrt[π] x (1 - x^2)^(-1 + n)
Gamma[n] Hypergeometric2F1[3/2, 1 - n, 1, x^2/(-1 + x^2)]  *)
• This is perfect. Thank you so much. Today is my first day studying Mathematica, and this helped me a lot! – Andeanlll Aug 28 '17 at 23:52