# linear algebra – How do I find a set containing all components of some vector and all of the ways we can the components?

I’m trying to find out a way to get all possible values you can get from both adding the components of a vector, and including the individual components themselves.

Example: Given the vector

$$y = left(begin{array}{} a \ b \ c \ end{array} right)$$

how can we find the set $${a, b, c, a+b, a+c, b+c}$$?

And further, is there some general rule we can apply to an n-dimensional vector?

Like

$$z = left(begin{array}{} a \ b \ vdots \ n end{array} right)$$

Lastly, if there is a general rule, is there some specific name for the operation/algorithm we use?

(I’m trying to do this exact thing in Java, but I’m trying to find some general algorithm first)