Answer
$\sin\angle D=\frac{\sqrt3}{3}$
$\cos\angle D= \frac{\sqrt6}{3}$
Work Step by Step
It's obvious that the triangle $\triangle EGD$ is the right triangle, where $\angle G$ is the right angle. We have to find sine and cosine of the angle $EDG$, let's note it by angle $D$.
By the definition sine is equal to the ratio of the side opposite a given angle (in a right-angled triangle) to the hypotenuse.
$\sin\angle D= \dfrac{opposite }{hypotenuse}$.
In our case
$\sin\angle D= \dfrac{EG}{ED}.$
Similarly, cosine is equal to the ratio of the side adjacent to an acute angle (in a right-angled triangle) to the hypotenuse.
$\cos\angle D= \dfrac{adjacent}{hypotenuse}=\dfrac{DG}{ED}$.
We just have to find $ED$, $DG$ because we know that $EG = 3$ inches. For that we will use Pythagorean theorem.
The triangle $\triangle GCD$ is the right triangle, where $\angle C$ is the right angle. So
$DG^{2}=GC^{2}+CD^{2}.$
For our cube $GC=CD= 3 $ inches. And DG is equal $DG=3\sqrt{2} $ inches.
The next right triangle is our well known $\triangle EGD$. Similarly,
$ED^2=DG^2+EG^2=(3\sqrt2)^2+3^2=3\cdot9.$
So $ED=3\sqrt3$ inches.
Now we have everything to find sine and cosine.
$$\sin\angle D=\dfrac{EG}{ED}=\dfrac{3}{3\sqrt3}=\dfrac{1}{\sqrt3}=\dfrac{\sqrt3}{3}$$
$$\cos\angle D=\dfrac{DG}{ED}=\dfrac{3\sqrt2}{3\sqrt3}=\dfrac{\sqrt2}{\sqrt3}=\dfrac{\sqrt6}{3}$$