I am looking for a general method to obtain derivative rules of a constrained matrix with respect to its matrix elements.
In the case of a symmetric matrix $S_{ij}$ (with $S_{ij}=S_{ji}$), one way to do that is the following (see Variation of the metric with respect to the metric). We say that a variation of a matrix element $\delta S_{ij}$ is the same than that of $\delta S_{ji}$, and thus $$ \delta S_{ij}=\frac{\delta S_{ij}+\delta S_{ji}}{2}=\frac{\delta_{ik}\delta_{jl}+\delta_{il}\delta_{jk}}{2}\delta S_{kl}=\mathcal S_{ij;kl}\delta S_{kl}. $$ The tensor $\mathcal S_{ij;kl}$ has the nice property that $\mathcal S_{ij;kl}\mathcal S_{kl;mn}=\mathcal S_{ij;mn}$. One then says that $$ \frac{\delta S_{ij}}{\delta S_{kl}}=\mathcal S_{ij;kl}. $$
I must admit that why this is the correct procedure is not quite clear to me (that seems to be quite arbitrary, although obviously it works to compute derivatives of a function of a symmetric matrix). This means that it is not clear to me how to generalize that when the constraint is different.
For example, let's take the set of matrices $O$ belonging to the group $SO(N)$. Is there a way to write $\frac{\delta O_{ij}}{\delta O_{kl}}$ in terms of a tensor $\mathcal B_{ij;kl}$, with all the same nice properties ?
In the case of $SO(2)$, this seems quite easy, since then $O_{ji}=(-1)^{i+j}O_{ij}$, and one finds in that case $$ \frac{\delta O_{ij}}{\delta O_{kl}}=\frac{\delta_{ik}\delta_{jl}+(-1)^{i+j}\delta_{il}\delta_{jk}}{2}, $$ which indeed does the job. Note however that I haven't use the defining property of $SO(N)$, that is $O O^T=1$, and I am not sure if this is relevant...
Already in the case of $SO(3)$, it does not seem to be easy to find the equivalent tensor...
Side note : using the defining property of $SO(2)$, one can massage the formulas to obtain $$ \frac{\delta O_{ij}}{\delta O_{kl}}=-O_{il}O_{kj}. $$ First of all, it depends explicitly on $O$, which seems bad. Furthermore, if we tentatively define $\mathcal B_{ij;kl}[O]=-O_{il}O_{kj}$ (which already is different from what we found for $SO(2)$), then we have $\mathcal B_{ij;kl}[O]\mathcal B_{kl;mn}[O]=\delta_{im}\delta_{jn}$, which seems pretty weird...
If anyone knows the standard procedure (if any exists) or a good reference, that would be greatly appreciated. In any case, a nice explanation (maybe a bit formal) in the case of symmetric matrix might also help me to get my head around the problem.