The given relation is obtained in case of an aqueous solution where amphiprotic species #HA^(-)#is produced on ionization of acid salt like #NaHCO_3# .
Here the spices acts both as acceptor or donor of proton.
Dissociation of original di-basic acid #H_2A# occurs in two steps as follows
#H_2A+H_2Ostackrel(K_1)rightleftharpoonsHA^(-)+H_3O^(+)#
#K_1=([HA^(-)][H_3O^(+)])/([H_2A]).......[1]#
#HA^(-)+H_2Ostackrel(K_2)rightleftharpoonsA^(2-)+H_3O^(+)#
#K_2=([A^(2-)][H_3O^(+)])/([HA])......[2]#
From [1] and [2] we get
#K_1xxK_2=([HA^(-)][H_3O^(+)])/([H_2A])xx([A^(2-)][H_3O^(+)])/([HA])#
#=>K_1xxK_2=([H_3O^(+)]^2xx[A^(2-)])/([H_2A]).....[3]#
Now if we consider the following equilibrium
#2HA^(-)rightleftharpoonsH_2A+A^(2-)#
then we can say that #[H_2A]=[A^(2-)]#
Applying this to [3] we get
#K_1xxK_2=[H_3O^(+)]^2#
Taking #log_10# on both sides
#log_10(K_1xxK_2)=log_10[H_3O^(+)]^2#
#=>-log_10K_1-log_10K_2=-2log_10[H_3O^(+)]#
#=>pK_1+pK_2=2pH#
#=>pH=1/2(pK_1+pK_2)#