Voltage divider with capacitor
This is a common trick.
Using high value resistors in your divider reduces current draw on the battery, so it's a good thing. However, SAR ADCs require the source impedance to be low enough so the voltage on the sampling capacitor (\$C_{sample}\$) is fully settled after sampling. This won't work with MOhm resistors.
So, you add \$C_{ext}\$. Before sampling, your resistors charge \$C_{ext}\$ to :
$$
V_{ain} = V_{Batt} \times \frac{R2}{(R1+R2)}
$$
Now, during sampling, we can suppose the resistors are large enough that all charge that goes into \$C_{sample}\$ comes from \$C_{ext}\$. The formula is the classical conservation of charge:
Before sampling,

\$C_{ext}\$ contains a charge \$q = V_{ain0} \times C_{ext}\$
\$C_{sample}\$ contains no charge (0V)

When the sampling is done, voltage in both caps is equalized, which means the original charge is now spread between both caps:
$$
q = V_{ain1} \times (C_{ext} + C_{sample})
$$
Voltage \$V_{ain}\$ went from \$V_{ain0}\$ to \$V_{ain1}\$:
$$
q = V_{ain0} \times C_{ext} = V_{ain1} \times (C_{ext} + C_{sample})
$$
Therefore:
$$
V_{ain1} = V_{ain0} \times \frac{C_{ext}}{(C_{ext} + C_{sample})}
$$
Since we choose \$C_{ext}\$ much bigger than \$C_{sample}\$, we can simplify:
$$
\frac{\Delta(V_{ain})}{V_{ain}} = \frac{C_{sample}}{C_{ext}}
$$
This means that if...

ADC is 10 bit
you want 1 LSB (0.1%) error due to \$C_{Sample}\$ charging
then you pick \$C_{ext} &gt; 1000 \times C_{Sample}\$