Answer
See below
Work Step by Step
a) We know that the diagonal element is $\frac{8}{4} = 2$ since we need to find a $4 \times 4$ matrix with a trace of 8 and every element on the main diagonal is equal. As a result, the matrix is:
$S=\begin{bmatrix}
2&0&0&0\\0&2&0&0\\0&0&2&0\\0&0&0&2
\end{bmatrix}$
b) Since we need a $3 \times 3$ matrix with a product of the elements on the main diagonal of $343$, and each element on the main diagonal is equal, we know that the diagonal element is the solution of the equation $x^3= 343$, and it is $7$
The matrix is:
$\begin{bmatrix}
7 &0 & 0\\0 & 7 & 0\\0& 0&7
\end{bmatrix}$