Linear Algebra Done Right -Sheldon Axler, Third Edition, Section 1.C, Page 23.
Condition for a direct sum:
Suppose $U_1,U_2,\ldots,U_m$ are subspaces of $V$. Then $U_1+\cdots+U_m$ is a direct sum if and only if the only way to write $0$ as a sum $u_1+\cdots+u_m$, where each $u_j$ is in $U_j$, is by taking each $u_j=0$.
I don't seem to understand their proof.
They first write $v=u_1+\cdots+u_m$ (where $u_1\in U_1,u_2\in U_2,\ldots,u_m\in U_m$) and also suppose that $v=v_1+\cdots+v_m$ (where $v_1\in U_1,\ldots,v_m\in U_m$).
Next, they subtract the two equations and write:
$$0=(u_1-v_1)+\cdots+(u_m-v_m)$$
"Because $u_1-v_1\in U_1,\ldots,u_m-v_m\in U_m$, the equation above implies that each $u_j-v_j=0$. Thus $u_1=v_1,\ldots,u_m=v_m$." I didn't understand how they deduced this. Why should $u_1-v_1\in U_1,\ldots,u_m-v_m\in U_m$ imply that each $u_j-v_j=0$ ?
They are proving that $U_1 + \ldots + U_m$ is a direct sum if the only way to write $0 = z_1 + \ldots + z_m$ with $z_i \in U_i$ is when all $z_i = 0$. To prove that, they assume that the only way to write $0 = z_1 + \ldots + z_m$ is when all $z_i = 0$, and then they prove that $U_1 + \ldots + U_m$ is indeed a direct sum.
To prove that something is a direct sum, one needs to prove that each vector $v \in U_1 + \ldots + U_m$ has a unique representation of the form $ v = u_1 + \ldots + u_m$ with $u_i \in U_i$. So they assume that they have some vector $v$ has two representations $v = u_1 + \ldots + u_m = v_1 + \ldots + v_m$, and they show that these representations are actually equal, that is, there's no way to have two different representations, so that the representation must be unique.
The way they prove is to note that if $v = u_1 + \ldots + u_m = v_1 + \ldots + v_m$, then $0 = v - v = (u_1 + \ldots + u_m) - (v_1 + \ldots + v_m) = (u_1 - v_1) + ... + (u_m - v_m)$. But since $u_i, v_i \in U_i$, we also have $u_i - v_i \in U_i$. But now, the assumption is that the only way to write $0 = z_1 + \ldots + z_m$ is when all $z_i = 0$, thus $u_i - v_i = 0$ for all $i$.