# Sets and sums of different elements

Consider the set S={w,x,y,z}. If the set of all possible sums of any three different elements from S is {-1,3,5,8}, then what is the set S?

How could I solve this function using Mathematica?

s = {w, x, y, z};
sum = {-1, 3, 5, 8};

add = Plus @@@ Subsets[s, {3}]
(* {w + x + y, w + x + z, w + y + z, x + y + z} *)

Solve[add == sum, s]
(* {{w -> -3, x -> 0, y -> 2, z -> 6}} *)

mat = ConstantArray[1, {4, 4}] - IdentityMatrix[4];
LinearSolve[mat, {-1, 3, 5, 8}]


{6, 2, 0, -3}

• ... or, perhaps, Permutations@LinearSolve[mat, {-1, 3, 5, 8}]. – kglr Apr 15 '16 at 21:42