Create lists like this: g = {1, 2, 3, 4} h = {10, 20, 30, 40} Then you can sum like this: Sum[g[[i]] h[[i]], {i, Length[g]}] or more nicely (Mathematica does element-wise operations automatically where applicable): Total[g*h]