This is a basic calculs/pre-calcuus question, that am having trouble with. For real matrices $A_{n \times n}$,$X_{n \times n}$ and $K_{n \times n}$ and a vector $c_{n \times 1}$, I want to have the derivative of the below function w.r.t the vector $c$ in a vector/matrix notation and not in terms of the individual entries of $c$. i.e the derivative w.r.t $c$ and not the derivative w.r.t each entry $c_i$. Note that $x_{i \mathbb{.}}$ denotes the row $i$ of $X$. I'd like to see a few steps in reasonable detail if you are re-arranging the below function in matrix notation! I also would like to have the second derivative w.r.t $c$.
The function is : $\sum_{i,j}A_{i,j}\left[\sum_{q=1}^nc_qK(x_{i\mathbb{.}},x_{q\mathbb{.}})-\sum_{l=1}^nc_lK(x_{j\mathbb{.}},x_{l\mathbb{.}})\right]^2$