Answer
$$\frac{dw}{dt}=-2t\sin(t^2-1)$$
Work Step by Step
(a) We will use Chain Rule:
$$\frac{dw}{dt}=\frac{\partial w}{\partial x}\frac{dx}{dt}+\frac{\partial w}{\partial y}\frac{dy}{dt}=\frac{\partial}{\partial x}(\cos(x-y))\frac{d}{dt}(t^2)+\frac{\partial}{\partial y}(\cos(x-y))\frac{d}{dt}(1)=-\sin(x-y)\frac{\partial}{\partial x}(x-y)\cdot2t-\sin(x-y)\frac{\partial}{\partial y}(x-y)\cdot0=-\sin (x-y)\cdot1\cdot2t-0=-2t\sin(x-y)$$
Expressing this in terms of $t$ we have:
$$\frac{dw}{dt}=-2t\sin(t^2-1)$$
(b) We will first convert $w$ to a function of $t$ and then differentiate.
$$w=\cos(x-y)=\cos(t^2-1)$$
$$\frac{dw}{dt}=\frac{d}{dt}(\cos(t^2-1))=-\sin(t^2-1)\frac{d}{dt}(t^2-1)=-\sin(t^2-1)\cdot2t=-2t\sin (t^2-1)$$