# Adding elements in the sublists

How can I add the elements in the sublists?
For example, if I have the list which is

 m={{1,3},{2,3},{4,1}}


then, the output that I want is 3+3+1=10. How can I do this?

-
You can use Part to get the elements from the list, then Total to sum them up. –  b.gatessucks Oct 30 '12 at 9:44
$3+3+1\neq 10\phantom{}$ –  Ｊ. Ｍ. Oct 30 '12 at 9:57
Plus @@@ (m\[Transpose]) will give you a list of the sums of the various elements of your list. –  image_doctor Oct 30 '12 at 10:00
@J.M. which is why this is a tricky question ;-) –  chris Oct 30 '12 at 10:25
@J.M. base 7? :^) –  Mr.Wizard Oct 30 '12 at 10:56

I thinks the cleanest way is:

Total[m[[All, 2]]]


using Esc[[Esc and Esc]]Esc.

If you use it a lot (like me), you can create shortcuts as explained here.

-
You can use these shortcuts if you don't like pressing Esc every time for Part brackets –  rm -rf Oct 30 '12 at 14:27
Yes, I use it. I put in the post. Tks –  Murta Oct 30 '12 at 18:46

Following @b.gatessucks

 Total[m[[;; , 2]]]

(* 7 *)


If you want to sum all components (as @image_doctor pointed out too, sorry I missed that)

 Plus @@@ Transpose[m]

(* 7 7 *)

-
Total[m[[All , 2]]] works as well. :) –  Ｊ. Ｍ. Oct 30 '12 at 12:05
Last@Total[{{1, 3}, {2, 3}, {4, 1}}]


or

Total[{{1, 3}, {2, 3}, {4, 1}}]


for both components

-