Summation involving addition modulo $2$ I'm working on a problem that I was able to reduce to the following:

Let $S$ be an $m$-dimensional subspace of $\mathbb{Z}_2^n$ and $\mathrm{w}\in \{0,1\}^n$. Prove that $$\sum_{\mathrm{s}\in S} (-1)^{\mathrm{s}\cdot \mathrm{w}} = 0 \Leftrightarrow \mathrm{w} \not\in S^{\perp}$$
where $\mathrm{s}\cdot\mathrm{w}=\mathrm{s_1}\mathrm{w_1}\oplus \dots \oplus \mathrm{s_n}\mathrm{w_n}$ and $\oplus$ denotes addition modulo $2$.

Now I approached the problem as follows: The forward implication is trivial. For the reverse, let $\{\mathrm{s_1},\dots \mathrm{s_m}\}$ be an orthonormal basis of $S$ and write $\mathrm{w}=\mathrm{s_w}\oplus\mathrm{s_w}' \in S \oplus S^\perp$ (direct sum). In that case, the sum comes out to
$$\sum_{\mathrm{s}\in S} (-1)^{\mathrm{s}\cdot \mathrm{s_w}}$$
and $\mathrm{s_w}\neq\mathbf{0}$. If $\mathrm{s_w}=\bigoplus \lambda_i \mathrm{s_i}$ and $\mathrm{s}=\bigoplus\kappa_i \mathrm{s_i}$ where $\lambda_i, \kappa_i \in \mathbb{Z}_2$ then
$$\mathrm{s}\cdot \mathrm{s_z}=\bigoplus_{i=1}^m \lambda_i\bigoplus_{j\neq i}\kappa_i$$
My idea from here is to show that for exactly half of the $2^m$ possible assignments for the values of $\kappa_i$ the above sum vanishes therefore proving the original statement.
Any input is appreciated.
 A: Suppose $w\not\in S^\perp$. We show that $\sum_{s\in S} (-1)^{s\cdot w} = 0$ by finding for every $s \in S$ such that $s \cdot w = 1$ an $r\in S$ such that $r\cdot w = 0$. Thus by pairing the sum is zero. Suppose then that $s\cdot w = 1$ for some $s \in S$. Since $w\not\in S^\perp$ there exists a $v\in S$ such that $v\cdot w = 1$. Let $r = s + v$. Then $r\cdot w = (s+v)\cdot w = s\cdot v + v\cdot w = 1 + 1 \equiv 0$.
Third time's the charm, right? ;)
A: So I think I figured it out. Let $\{s_1,\cdots,s_m\}$ be a basis of $S$ and also let $s = a_1 s_1 \oplus a_2 s_2 \oplus \dots \oplus a_m s_m$. Since $w\not\in S^\perp$ we have
$$s\cdot w = a_1 (s_1\cdot w) \oplus \dots \oplus a_m(s_m\cdot w)$$
with not all $s_i \cdot w$ being zero.
Now partition the $s_i$'s in two sets $I_0$ and $I_1$ depending on whether $s_i \cdot w$ equals zero or one. Now notice that if the size of $I_1$ is odd then an assignment of $a_i$'s will give $s\cdot w = 1$ if and only if its complement will give $0$. If the size of $I_1$ is even then every assignment of $a_i$'s will give the same value as its complement and exactly half of them will give $0$ (those who select an even number of elements from $I_1$) and the rest will give $1$. In any case, the number of $+1$ terms in our summation will be equal to the number of $-1$ terms. Turns out not much linear algebra was needed!
