3D linear transport equation solution If we consider the following transport equation with $t>0$ and $x\in \mathbb{R^3}$:
$$\begin{cases}
\partial_t f(t,x) + v(t,x). \nabla f(t,x)=0\\
f(0,x)=g(x)
\end{cases}$$
And if we define the follwing function $X$ defined on $(s,t,x)\in\mathbb{R^+}\times\mathbb{R^+}\times\mathbb{R^3}$:
$$\begin{cases}
\frac{d}{ds}X(s,t,x)=v(t,X(s,t,x))\\
X(t,t,x)=x
\end{cases}$$
I want to prove that the function: $f(t,x)=g(X(0,t,x))$ is a solution the firt PDE (transport equation).
My idea:
I tried to calculate $$\partial_t f(t,x) + v(t,x). \nabla f(t,x)=\partial_t g(X(0,t,x)) + v(t,x). \nabla g(X(0,t,x))$$
$$\partial_t f(t,x) + v(t,x). \nabla f(t,x)=\partial_t X(0,t,x) \nabla g(X(0,t,x)) + v(t,x). \nabla g(X(0,t,x))$$
$$\partial_t f(t,x) + v(t,x). \nabla f(t,x)=[\partial_t X(0,t,x) + v(t,x)] \nabla g(X(0,t,x))$$
But i dont what to do next to show that it equals to zero.
 A: For the transport equation $\partial_t f + v \cdot \nabla f = 0$ with initial data $f(0,x) = g(x)$, the method of characteristics gives
$\frac{\text d}{\text d t} X = v$ and $\frac{\text d}{\text d t} f = 0$. Along the characteristic curves $t\mapsto X(t)$, we have therefore $f(t,X(t)) = g(x_0)$, where the curve trajectory satisfies the differential equation
$$
\frac{\text d}{\text d t} X(t) = v(t,X(t))
\qquad\text{with}\qquad
\quad X(t) = x,\quad X(0) = x_0 .
$$
Thus, we may write
$x = x_0 + \int_0^t v(\tau ,X(\tau ))\, \text d \tau$ by using the FTC. Injecting this in the expression of $f$ along characteristics, we have finally
$$
f(t,x) = g\left(x - \int_0^t v(\tau , X(\tau ))\, \text d \tau\right) ,
$$
where the function $\tau\mapsto X(\tau)$ solves the above initial value problem. In the particular case where the velocity vector $v$ is constant in time and space, we recover the classical solution $f(t,x) = g(x-tv)$.
To show that the above expression works, let us compute partial derivatives in space and time. We have
\begin{aligned}
\partial_t f &= \partial_t x_0\cdot \nabla g(x_0)  = -v\cdot \nabla g(x_0) \\
\nabla f &= \nabla x_0\cdot \nabla g(x_0) = \nabla g(x_0)
\end{aligned}
which ends the proof.
