Let $Q, R \in \mathbb{R}^{n\times n}$ such that $Q, R \succ 0$. Let $g\left(\boldsymbol{x}\right) : \mathbb{R}^{n} \to \mathbb{R}$ such that
$$g\left(\boldsymbol{x}\right)=\left(\frac{1}{2}\boldsymbol{x}^{T}Q\boldsymbol{x}\right)\left(\frac{1}{2}\boldsymbol{x}^{T}R\boldsymbol{x}\right)$$
I want to find the gradient and the Hessian of $g\left(\boldsymbol{x}\right)$.
What I tried so far
To find the gradient and the Hessian using the derivative rules and got the following:
but while I notice (2nd element of the last row at the hessian calculation Ive got the term $2R\boldsymbol{x}\cdot Q\boldsymbol{x}$ which is column vector times another column vector and that's obviously a mistake.on my calculations product rule of gradient but I don't sure if It's a valid rule at matrix calculus. So, how can I calculate the gradient and the hessian of $g\left(\boldsymbol{x}\right)$?

I would suggest the following: $g(x)$ can be rewritten as $$ g(x)=\left(\frac{1}{2}\sum_{i,j=1}^nQ_{ij}x_ix_j\right)\left(\frac{1}{2}\sum_{i,j=1}^nR_{ij}x_ix_j\right) $$ where $Q_{ij}$ and $R_{ij}$ are the coefficients of the matrices $Q$ and $R$. Now you can proceed similarly as you did, taking derivative with respect to $x_k$, $k=1,\ldots,n$: $$ \frac{\partial g}{\partial x_k}=\left(\frac{1}{2}\frac{\partial}{\partial x_k}\sum_{i,j=1}^nQ_{ij}x_ix_j\right)\left(\frac{1}{2}\sum_{i,j=1}^nR_{ij}x_ix_j\right)+\left(\frac{1}{2}\sum_{i,j=1}^nQ_{ij}x_ix_j\right)\left(\frac{1}{2}\frac{\partial}{\partial x_k}\sum_{i,j=1}^nR_{ij}x_ix_j\right). $$
Can you take it from here?