partial differentiation and quotient rule I want to compute a partial differentiation $\frac{\partial A}{\partial q}$ where A is ($\ddot{q}$), the output of standard manipulator equation, i.e.
$$ H(q)\ddot q + C(q,\dot q)\dot q+G(q) =0 $$
$A = (C*\dot{\theta} + G)/H $ and $q$ is a vector $[q_1 q_2 q_3 q_4]$. 
Also C and H are $2\times2$ matrices and G is a $2\times1$ matrix with elements function of $q$. My problem is, as division is involved (computed as matrix inverse), how should I compute the partial differentiation? Should I apply the quotient rule? And if I apply the quotient rule then I am unable to compute the numerator as the matrices are turning out such that I cannot multiply them.
Thanks.      
 A: $$\ddot{q}=A(q,\dot{q}):=-H^{-1}(q)[C(q,\dot{q})\dot{q}+G(q)]$$
So your derivative is a matrix with matrix elements i.e.
$$\frac{\partial A(q,\dot{q})}{\partial q}=\left[\matrix{\frac{\partial A(q,\dot{q})}{\partial q_i}}\right] $$
and each element has the form
$$\frac{\partial A(q,\dot{q})}{\partial q_i}=\frac{\partial}{\partial q_i}\left\{H^{-1}(q)C(q,\dot{q})\dot{q}\right\}+\frac{\partial}{\partial q_i}\left\{H^{-1}(q)G(q)\right\}=\frac{\partial}{\partial q_i}\left\{H^{-1}(q)\right\}C(q,\dot{q})\dot{q}+H^{-1}(q)\frac{\partial}{\partial q_i}\left\{C(q,\dot{q})\right\}\dot{q}+\frac{\partial}{\partial q_i}\left\{H^{-1}(q)\right\}G(q)+H^{-1}(q)\frac{\partial}{\partial q_i}\left\{G(q)\right\}=-H^{-1}(q)\frac{\partial}{\partial q_i}(H(q))H^{-1}(q)[C(q,\dot{q})\dot{q}+G(q)]+H^{-1}(q)\frac{\partial}{\partial q_i}\left\{C(q,\dot{q})\right\}\dot{q}+H^{-1}(q)\frac{\partial}{\partial q_i}\left\{G(q)\right\}=H^{-1}(q)\left[\frac{\partial}{\partial q_i}\left\{C(q,\dot{q})\right\}\dot{q}+\frac{\partial}{\partial q_i}\left\{G(q)\right\}-\frac{\partial}{\partial q_i}\{H(q)\}H^{-1}(q)\left[C(q,\dot{q})\dot{q}+G(q)\right]\right]$$
Note that each $\frac{\partial A(q,\dot{q})}{\partial q_i}$ is a $2\times 1$ vector so your overall derivative can be either a $4\times 1$ vector or a $2\times 2$ matrix.
