Consider the $r\times 2^r-1$ matrix
$$\mathbf{G} = \left(\begin{matrix}1 & 0 & 1 & 0 & 1 & 0 & 1\\ 0 & 1 & 1 & 0 & 0 & 1 & 1\\ 0 & 0 & 0 & 1 & 1 & 1 & 1 \end{matrix}\right)\text{,}$$
created by considering all possible combinations $\left(c_i + c_j \mod 2 \right)$ of the three independent columns:
$$ \left(\begin{matrix} 1 \\ 0 \\ 0 \end{matrix}\right) \left(\begin{matrix} 0 \\ 1 \\ 0 \end{matrix}\right) \left(\begin{matrix} 0 \\ 0 \\ 1 \end{matrix}\right)\text{.} $$
Now I want to find all possible triplets of the form $(c_1,c_2,c_3)$ for $c_i \in \mathbf{G}$ so that $\left(c_3 = c_1 + c_2 \mod 2\right)$. I know that for $\mathbf{G}$, there are 7 such triplets:
- $c_1,c_2,c_3$
- $c_1,c_4,c_5$
- $c_2,c_3,c_6$
- $c_1,c_6,c_7$
- $c_2,c_5,c_7$
- $c_3,c_4,c_7$
- $c_3,c_5,c_6$
However I would like to know if there is a formula to know the number of such triplets for a given value of $r$, i.e. for $r=3$ $n_{triplets}=7$, for $r=4$ $n_{triplets}=35$, etc...
There are $\frac 16(2^r-1)(2^r-2)$ triplets. As you say, there are $2^r-1$ columns in $G$. You can take any two of them in $(2^r-1)(2^r-2)$ ordered ways. You find the third by doing the bitwise XOR of the first two columns. Then you put the indices in order, which picks one order out of $6$ for the three columns.