Two's complement general formula
Let $a_{N-1} \cdots a_0$ be the two's complement representation of the number $a$. The more general formula is:
$$a = -a_{N-1}2^{N-1} + \sum_{i=0}^{N-2} a_i 2^i$$
(I am sure you can figure out how your formulas can be derived from this one.)

Why does this hold? For $a \ge 0$, $a_{N - 1} = 0$ and then the value of $a$ is simply the value of the binary representation $a_{N-2} \cdots a_0$. For $a &lt; 0$, on the other hand, let $b = -a \ge 0$ have binary representation $b_{N-1} \cdots b_0$. Then
$$\sum_{i=0}^{N-1} a_i 2^i = \sum_{i=0}^{N-1} (1-b_i) 2^i + 1 
= \sum_{i=0}^{N-1} 2^i - \sum_{i=0}^{N-1} b_i 2^i + 1  = 2^N - b$$
since the two's complement is defined as the complement of the representation $b_{N-1} \cdots b_0$, plus one, and $\sum_{i=0}^{N-1}2^i = 2^N - 1$. Since $a$ is negative, $a_{N-1} = 1$ and then:
$$a = -b
= -2^N + \sum_{i=0}^{N-1} a_i 2^i
= -2^N + 2^{N-1} + \sum_{i=0}^{N-2} a_i 2^i
= -2^{N-1} + \sum_{i=0}^{N-2} a_i 2^i
$$



I have refrained from giving an explicit example as you had asked; I believe explaining why the formula works in the first place is far more instructive.