What is the formula for theoretical buffer capacity for a diprotic buffer system?
The logic is the same used for a monoprotic weak acid, considering the two ionization steps, as indicated by @MaxW.

For a diprotic weak acid we have:

The first ionization

\begin{align*}
\ce{H2A + H2O &amp;&lt;=&gt; H3O+ + HA-} &amp;K_{\ce{a}1}=\frac{\ce{[H3O+][HA-]}}{\ce{[H2A]}}
\end{align*}

and the second ionization

\begin{align*}
\ce{HA- + H2O &amp;&lt;=&gt; H3O+ + A^{2-}} &amp;K_{\ce{a}2}=\frac{\ce{[H3O+][A^{2-}]}}{\ce{[HA-]}}
\end{align*}

To make further calculations easier let's assume that the strong base added is monoprotic:

\begin{align*}
\ce{BOH &amp;-&gt; B+ + HO-}
\end{align*}

Charge balance of the solution is given by the equation

$$\ce{[H3O+]} + \ce{[B+]} = \ce{[OH-]} + \ce{[HA-]} + \ce{2[A^{2-}]}$$

When combined give us formula for the amount of the strong base (for short $\ce{[H3O+]}$ was written as $\ce{[H+]}$)

$$C_{\ce{B}} = 
\frac{K_{\ce{w}}}{\ce{[H+]}}-
\ce{[H+]}+
\frac{C_{\ce{H2A}}K_{\ce{a}1}\left(\ce{[H+]}+2K_{\ce{a}2}\right)}
{\ce{[H+]}^2 + K_{\ce{a}1}\ce{[H+]} + K_{\ce{a}1}K_{\ce{a}2}}$$

when $K_\ce{w}$ is the water ionization equilibrium constant, $C_{\ce{H2A}}$ is the concentration of diprotic weak acid, $K_{\ce{a}1}$ and $K_{\ce{a}2}$ are the acid dissociation constants, and $C_{\ce{B}}$ is the concentration of strong base added.

The buffer capacity of a diprotic weak acid-conjugate bases buffer is defined as the
maximum amount strong base that can be added before a significant change in the pH will occur.

\begin{align*}
\beta &amp;= \frac{dC_{\ce{B}}}{d\ce{pH}} = \frac{dC_{\ce{B}}}{d\ce{[H3O+]}}\frac{d\ce{[H3O+]}}{d\ce{pH}}\\
\end{align*}

Differentiating the equation we should then find that

\begin{align*}
\beta &amp;= \left[-\frac{K_{\ce{w}}}{\ce{[H+]}^2}-1 -
\frac{C_{\ce{H2A}}K_{\ce{a}1} \left(\ce{[H+]}^2 + 4K_{\ce{a}2}\ce{[H+]} + K_{\ce{a}1}K_{\ce{a}2} \right)}
{\left(\ce{[H+]}^2 + K_{\ce{a}1}\ce{[H+]} + K_{\ce{a}1}K_{\ce{a}2}\right)^2}\right]
\left(-\ce{[H+]}\ln{10}\right)
\end{align*}

So finally buffer capacity is given by

\begin{align*}
\beta &amp;= 2.303\left[\frac{K_{\ce{w}}}{\ce{[H+]}}+\ce{[H+]}+
\frac{C_{\ce{H2A}}K_{\ce{a}1}\ce{[H+]}\left(\ce{[H+]}^2 + 4K_{\ce{a}2}\ce{[H+]} + K_{\ce{a}1}K_{\ce{a}2} \right)}
{\left(\ce{[H+]}^2 + K_{\ce{a}1}\ce{[H+]} + K_{\ce{a}1}K_{\ce{a}2}\right)^2}\right]
\end{align*}

you can then plot $\beta$ vs $\ce{pH}$ and from this you should be able to find what you want.

Look a example based on this question. I hope it be useful.