Number of weight 3 codewords in Ham(r,2) Show that the number of codewords of weight 3 in the Hamming code, Ham(r,2), where r is the redundancy and 2 indicates a binary code, is
$$\frac{(2^r-1)(2^{r-1}-1)} {3}$$ 
So, I know Ham(r,2) contains codewords of length $n= 2^r-1$ and that $2^{r-1}-1$ of them are nonzero. 
Moreover, I know that every unique codeword of weight three in Ham(r,2) can be defined by a unique set of three linearly dependent columns of the corresponding parity-check matrix for Ham(r,2).
So... My idea was to simply set up a counting argument; say, given that every codeword of weight 3 is defined by a set of three linearly dependent columns of the parity-check matrix and there are $n = 2^r-1$ of them, then there are $n \choose 3$ possible codewords of weight 3.
Problem is the algebra just isn't getting me from $${n \choose 3 } =\frac{(2^r-1)!} {3!(2^r-4)!}$$ to $$\frac{(2^r-1)(2^{r-1}-1)} {3}$$ I'm I just messing up on the algebra or I'm i just going at it the wrong way... 
 A: 
... then there are $n \choose 3 $ possible codewords of weight 3.

That would be true if any combination of 3 colums of H were linearly dependent, which would imply that any $n-$ tuple of weight $3$ is a codeword (obviuosly false).
We know that $H$ has $n$ different (nonzero) $r-$tuples. We are interested in picking three of them $h_1$, $h_2$, $h_3$ such that $h_1+h_2+h_3=0$ (LD set). Imagine we pick the first two  $h_1$, $h_2$ arbitrarily; now, see that there's one and only one $h_3$ that make the set LD. We have $n \choose 2$ ways of choosing the first pair, and $h_3$ is determined. But wait, we must divide by 3 to avoid counting as different the cases where $h_3$ is in the three possible positions. So the total number is
$$ \frac{n \choose 2}{3} =\frac{n (n-1)}{6}=\frac{(2^r-1)(2^r-2)}{6}=\frac{(2^r-1)(2^{r-1}-1)}{3}$$
A: The third of the linear dependent columns comes from the first two ones, and therefor is not 'free' to choose.
So you should select only two columns to get the third one.
Then, there are 3 ways to select two columns to get each set of 3.
Change your formula's accordingly... ${n \choose 2 }/ 3$
Final hint, which you probably don't need: ${(2^r - 2)}/2 = 2^{r-1}-1$ 
A: Em…… I solve this problem in a different way from the existing answers, taking the hint similar to what is provided here.
$\mathcal{H}_2(r)$ is a $[n,k,d]$ perfect binary code with
$$
n = 2^r-1,k = n-r,d = 3
$$
So the space $\mathbb{Z}_2^n$ should be covered by the non-overlapping spheres $S_2^n(c,\rho)$ for all $c\in\mathcal{H}_2(r)$ with $\rho = \lfloor\frac{d}{2}\rfloor = 1$.
Define $X = \{c\in\mathcal{H}_2(r)|w(c) = 3\}$ and denote $N = |X|$. 
Consider the strings with weight $2$, $Y = \{s_i\}$. Suppose $s_i\in S_2^n(c,1)$ for some $c\in\mathcal{H}_2(r)$, then either $w(c) = 2\pm1$ or $c = s_i$. Since $w(c)\geq d = 3$, $w(c)$ must be $3$, implying that $c\in X$. 
It's apparent that for $c\in X$
$$
|S_2^n(c,1)\cap Y| = 3
$$
So, we have $N = \frac{|Y|}{3} = \frac{\binom{n}{2}}{3} = \frac{(2^r-1)(2^r-2)}{6}$
