Finding a basis and dimension of a subspace of R^n. I was trying the following question :
$$W=\{(x_1,...,x_n)|x_1+...+x_n=0\}$$ is a subset of R^n.
I am supposed to find a basis for it and hence its dimension. 
I wasn't directly able to write down a general basis of $W$ as a subspace of $\mathbb{R}^n$, so I wrote a basis for $W$ as a subspace of $\mathbb{R}$ and $\mathbb{R}^2$. But I'm not able to write for $\mathbb{R}^3$.
I am speculating that the dimension of $W$ as a subspace of $\mathbb{R}^n$ where $n$ is not equal to 1 is 1 because the subspace looks like a line passing through the origin. If $W$ is considered as a subspace of $\mathbb{R}$ then $W$ is singleton 0, hence dimension is 0.
Any help to write down a basis for $W$ is appreciated. Thanks :)
 A: We are considering ordered tuples $(x_{1}, \dots, x_{n})$ satisfying $x_{1} + \dots + x_{n} = 0$.
Solving for $x_{n}$ gives us that $x_{n} = -x_{1} - \dots - x_{n - 1}$, right?  That means all tuples of the form $(x_{1}, x_{2}, \dots, x_{n-1}, -x_{1} -x_{2} - \dots - x_{n-1} )$ satisfy $x_{1} + \dots + x_{n} = 0$.  We can see from this that $x_{1}, \dots, x_{n-1}$ are free variables -- we can pick them to be anything.  We can't pick $x_{n}$ to be anything though.  $x_{n}$ is determined by our choices for $x_{1}, \dots, x_{n-1}$ since $x_{n} = -x_{1} - \dots - x_{n-1}$.
So, since we have $n-1$ variables that we are allowed to choose freely, that means $W$ has dimension $n-1$.  Here is a hint for finding a basis for $W$:
Consider the vector $\begin{bmatrix} x_{1} \\ x_{2} \\ \vdots \\ x_{n-1} \\ -x_{1} - x_{2} - \dots - x_{n-1}  \end{bmatrix}$.
Try to write this as $x_{1} v_{1} + \dots + x_{n-1} v_{n-1}$, where the $v$'s are vectors, and then the vectors $\{v_{1}, \dots, v_{n-1} \}$ will be your basis.
