partial derivative

I'm new to Mathematica, and I'm still learning. I'm trying to code this partial differentiation. Can someone please help me find out where I coded wrong? I've attached a hand-written solution below.

• Please post your code, not images. Thanks. Apr 19, 2020 at 0:30

D[x1Com,x[1,i]] will give zero, since there is no x[1,i] any more in x1Com. There is only x[1,1] and x[1,2] and so on.

One way could be

ClearAll[x1Com, x, m];
x1Com = HoldForm@(Sum[(m[1, i]*x[1, i]), {i, 1, 6}]/Sum[m[1, i], {i, 1, 6}])


Now make a function to differentiate w.r.t. to specific x[1,i]

diff[x1Com_, x_] := D[ReleaseHold@x1Com, x];


Now use it

diff[x1Com, x[1, 1]]


diff[x1Com, x[1, 2]]


And so on.