You might want to first carry out a ($x$-dependent) unitary transformation of $A(x)$, such that all diagonal elements are zero.$^\ast$ Then $A(x)=BC(x)-C(x)B$ with $$B=\begin{pmatrix} 1&0&0\\ 0&2&0\\ 0&0&3 \end{pmatrix},\;\; C_{ij}(x)=\begin{cases} 0&\text{if}\;i=j\\ \frac{A_{ij}(x)}{B_{ii}-B_{jj}}&\text{if}\;\;i\neq j. \end{cases} $$ --- $^\ast$ This is always possible for a traceless $A$, see for example https://math.stackexchange.com/q/267192/87355 For a $3\times 3$ real matrix the unitary has the single-parameter form $$U(x)=\begin{pmatrix} \cos\alpha(x)&\sin\alpha(x)&0\\ -\sin\alpha(x)&\cos\alpha(x)&0\\ 0&0&1 \end{pmatrix}.$$