# Find derivatives with respect to parameter or initial condition

Find stated derivatives with respect to parameter or initial condition:

a) $x'=x+\mu(t+x^2), x(0)=1 ;$ find $\frac{\partial x}{\partial \mu}|_{\mu=0}$ ,

b) $x'=2t+\mu x^2, x(0)=\mu -1;$ find $\frac{\partial x}{\partial \mu}|_{\mu=0}$ ,

c) $x'=x+x^2 +tx^3, x(2)=x_0 ;$ find $\frac{\partial x}{\partial \mu}|_{\mu=0}$ ,

Please help me with at least one of them, and I will try to make the others. I really don't know what to do in here.

• Informally, you interchange the time and $\mu$ derivatives and get a differential equation (which involves the solution of the original equation). The last one is trivial. Commented Jun 5, 2018 at 16:22

Suppose we have a more-or-less general differential equation such as

$\dot{\vec x} = \vec F(\vec x, t, \mu), \tag 1$

which depends on some parameter $\mu$; here I take $\vec x(t) \in \Bbb R^n$, and assume that the vector function $\vec F(\vec x, t, \mu) \in \Bbb R^n$ is "sufficiently differentiable" for what follows; we'll see as we go along; for now, we'll just assume that if we need a derivative of $\vec F(\vec x, \mu, t)$, it will be there for us. Now the solutions $\vec x(t, \mu)$ to (1) will in general themselves be differentiable functions of both $t$ and $\mu$, so we have

$\dot{\vec x}(t, \mu) = \vec F(\vec x(t, \mu), t, \mu), \tag 2$

which, since $\vec x(t, \mu)$ is now a function of two-variables, we may find convenient to write in the form

$\dfrac{\partial \vec x(t, \mu)}{\partial t} = \vec F(\vec x(t, \mu), t, \mu); \tag 3$

we may also differentiate (3) with repsect to $\mu$:

$\dfrac{\partial}{\partial \mu} \dfrac{\partial \vec x(t, \mu)}{\partial t} = \dfrac{\partial}{\partial \mu} \vec F(\vec x(t, \mu), t, \mu); \tag 4$

we may re-write the right-hand side of this equation by means of the chain rule:

$\dfrac{\partial}{\partial \mu} \vec F(\vec x(t, \mu), t, \mu) = D_{\vec x}\vec F(\vec x(t, \mu), t, \mu) \dfrac{\partial \vec x(t, \mu)}{\partial \mu} + \dfrac{\partial \vec F(x(t, \mu), t, \mu)}{\partial \mu}; \tag 5$

in this equation, $D_{\vec x} \vec F(x(t, \mu), t, \mu)$ is in fact the Jaocbian matrix of $\vec F(x(t, \mu), t, \mu)$ with respect to the vector $\vec x$:

$[D_{\vec x} \vec F] = \left[ \dfrac{\partial \vec F_i(\vec x(t, \mu), t, \mu)}{\partial x_j} \right ], \tag 6$

$\partial \vec x(t, \mu) / \partial \mu$ is the vector of $\mu$-derivatives of the components of $\vec x(t, \mu)$:

$\dfrac{\partial \vec x(t, \mu)}{\partial \mu} = \begin{pmatrix} \dfrac{\partial \vec x_1(t, \mu)}{\partial \mu}, \dfrac{\partial \vec x_2(t, \mu)}{\partial \mu}, \ldots, \dfrac{\partial \vec x_n(t, \mu)}{\partial \mu}\end{pmatrix}^T, \tag 7$

and $\partial \vec F(\vec x(t, u), t, \mu) / \partial \mu$ is the vector of $\mu$-derivatives of the components of $\vec F(x(t, \mu), t)$:

$\dfrac{\partial \vec F(\vec x(t, u), t, \mu)}{\partial \mu}$ $= \begin{pmatrix} \dfrac{\partial \vec F_1(\vec x(t, u), t, \mu)}{\partial \mu}, \dfrac{\partial \vec F_2(\vec x(t, u), t, \mu)}{\partial \mu}, \ldots, \dfrac{\partial \vec F_n(\vec x(t, u), t, \mu)}{\partial \mu}\end{pmatrix}^T. \tag 8$

Turning now to the left-hand side of (4), we recall that if $\vec x(t, \mu)$ is a smooth (= "differentiable") enough function of both $t$ and $\mu$, then the order of the partial derivatives taken may be exchanged, viz.

$\dfrac{\partial}{\partial \mu} \dfrac{\partial \vec x(t, \mu)}{\partial t} = \dfrac{\partial}{\partial t} \dfrac{\partial \vec x(t, \mu)}{\partial \mu}; \tag 9$

if we now re-assemble (4), (5), and (9), we find

$\dfrac{\partial}{\partial t} \dfrac{\partial \vec x(t, \mu)}{\partial \mu} = D_{\vec x}\vec F(\vec x(t, \mu), t, \mu) \dfrac{\partial \vec x(t, \mu)}{\partial \mu} + \dfrac{\partial \vec F(x(t, \mu), t, \mu)}{\partial \mu}, \tag{10}$

which is in general a linear, time-dependent, inhomogeneous ordinary differential equation for $\partial \vec x(t, \mu) / \partial \mu$; we take note of the fact that the particular equation we will obtain in (10) depends on the particular trajectory $\vec x(t, \mu)$ of (1) along which $\partial \vec x(t, \mu) / \partial \mu$ is taken; thus, in order find $\partial \vec x(t, \mu) / \partial \mu$ for a particular $\mu_0$, we must first solve (2) with $\mu = \mu_0$ and appropriate initial conditions on $x(t, \mu_0)$; then, having this trajectory, we may insert $x(t, \mu_0)$ into (10), which may then be solved for $\partial \vec x(t, \mu_0) / \partial \mu$ according to its initial data.

We may illustrate this process by means of the examples given in the text of the question. If, for intance,

$\dot x = x + \mu(t + x^2), \; x(0, \mu) = 1, \tag{11}$

and we seek to find

$\dfrac{\partial x(t, \mu)}{\partial \mu}, \; \mu = 0, \tag{12}$

we first solve (11) for the case $\mu = 0$; i.e.,

$\dot x(t, 0) = x(t, 0); \; x(0, 0) = 1; \tag{13}$

the solution is evidently

$x(t, 0) = e^t; \tag{14}$

we use this to build the linear equation obeyed by (12) according to (10); dropping the vector notation $\vec x$ in favor of $x$ since we are now apparently dealing with scalar quantities, we have

$F(x, t, \mu) = x + \mu(t + x^2), \tag{15}$

$D_xF = \dfrac{\partial F}{\partial x} = 1 + 2\mu x = 1 \; \text{when} \; \mu = 0, \tag{16}$

$\dfrac{\partial F}{\partial \mu} = t + x^2; \tag{17}$

with $x(t, 0)$ as in (14) we have

$D_xF = 1, \tag{18}$

$D_\mu F = t + e^{2t}; \tag{19}$

it then follows from these equations and (14) that $x_\mu = \partial x / \partial \mu$ satisfies

$\dot x_\mu = x_\mu + t + e^{2t}; \tag{20}$

since we are given that, in this instance that $x(0) = 1$ independently of $\mu$, we have

$x_\mu(0) = \dfrac{\partial x(0)}{\partial \mu} = \dfrac{\partial (1)}{\partial \mu} = 0, \tag{21}$

which provides the initial condition for (20); the solution to (20)-(21) is well-known to be given by the classical formula for solutions to general equations of the form

$\dot z = \alpha z + \beta(t), \; z(t_0) = z_0, \tag{22}$

which is in fact

$z(t) = e^{\alpha (t - t_0)}(z_0 + \displaystyle \int_{t_0}^t e^{\alpha (t_0 - s)} \beta(s) \; ds), \tag{23}$

as may be verified by directly substituting (23) into (22); when this formula is applied to (20)-(21) we find

$x_\mu(t) = e^t \displaystyle \int_0^t e^{-s}(s + e^{2s}) \; ds = \int_0^t (s e^{-s} + e^s) \; ds$ $= \displaystyle \int_0^t se^{-s} \; ds + \int_0^t e^s \; ds = [(1 - s)e^{-s}]_0^t + [e^s]_0^t = (1 - t)e^{-t} + e^t - 2; \tag{24}$

therefore

$\dfrac{\partial x(t, \mu)}{\partial \mu}(\mu = 0) = (1 - t)e^{-t} + e^t - 2. \tag{25}$

For the second equation,

$\dot x = 2t + \mu x^2, \; x(0, \mu) = \mu - 1, \tag{26}$

we have

$F(x, t, \mu) = 2t + \mu x^2, \tag{27}$

$F_x(x, t, \mu) = 2\mu x, \tag{28}$

$F_\mu(x, t, \mu) = x^2, \tag{29}$

the $\mu = 0$ instance of (26) is

$\dot x = 2t, \; x(0) = -1, \tag{30}$

whence

$x(t, 0) = t^2 - 1; \tag{31}$

then

$\dot x_\mu = (x(t, 0))^2 = (t^2 - 1)^2 = t^4 - 2t^2 + 1; \tag{32}$

from (26),

$x_\mu(0, 0) = x_\mu(0, \mu) = 1 \; \text{for all} \; \mu, \tag{33}$

and it follows that

$x_\mu(t, 0) = \dfrac{t^5}{5} - \dfrac{2t^3}{3} + t + 1. \tag{34}$

At first sight the third example,

$\dot x = x + x^2 + tx^3, \; x(2) = x_0, \tag{35}$

appears unassailable since (35) is difficult to solve explicitly; indeed, there may not be a closed-form solution. We overcome our apprehensions, however, if we go ahead and calculate the various derivatives of

$F(x, t, \mu) = x + x^2 + tx^3: \tag{36}$

$F_x(x, t, \mu) = 1 + 2x + 3tx^2; \tag{37}$

$F_\mu(x, t, \mu) = 0; \tag{38}$

now whatever $x(t, 0)$ may be (10) yields

$\dot x_\mu = (1 + 2x(t, 0) + 3tx^2(t, 0)) x_\mu, \tag{39}$

a homogeneous, linear equation for $x_\mu$, and since we see from (35) that

$x_\mu(0, \mu) = 0 \tag{40}$

for all $\mu$, we infer that the unique solution to (39) is

$x_\mu(t, 0) = 0. \tag{41}$

Note Added in Edit, Saturday 9 June 2018 7:08 PM PST: At the request of our OP MacAbra, I am going to present the solution of just one more one-dimensional variational problem. See below. End of Note.

The equation addressed in MacAbra's comment is:

$\dot x = t^{-1}x + \mu t e^{-x}, \; x(1) = 1; \tag{42}$

here we have

$F(x, t, \mu) = t^{-1}x + \mu t e^{-x}, \tag{43}$

whence

$F_x(t, x, \mu) = t^{-1} - \mu t e^{-x}, \tag{44}$

$F_\mu(t, x, \mu) = t e^{-x}; \tag{45}$

when $\mu = 0$, (42) becomes

$\dot x = t^{-1}x, \; x(1) = 1; \tag{46}$

the solution is

$x = t; \tag{47}$

we have

$F_x(x, t, 0) = t^{-1}, \tag{48}$

$F_\mu(x, t, 0) = te^{-x} = te^{-t} \tag{49}$

in the light of (47); then the equation (10) becomes, for $\mu = 0$,

$\dot x_\mu = t^{-1} x_\mu + te^{-t}; \tag{50}$

also, from (42),

$x(1, \mu) = x(1) = 1, \tag{51}$

whence

$x_\mu(1, 0) = x_\mu(1, 0) = 0; \tag{52}$

without going through the details of finding the solution, we may thanks to MacAbra's comment simply verify that

$x_\mu(t) = e^{-1}t - te^{-t} \tag{53}$

satisfies both (50) and (52). And so it does.

• I have more exercises like this. For example $x'=\frac{x}{t}+\mu te^{-x}$, $x(1)=1$. Is $x_{\mu}=\frac{t}{e}-te^{-t}$ the correct solution? Commented Jun 9, 2018 at 11:49
• @MacAbra: I added your requested solution to my answer. Cheers! Commented Jun 10, 2018 at 3:14

Regarding the first exercise.

Given a differential equation $$\dot{x}=f(x,\mu)$$ the sensitivity of $x(t,\mu)$ regarding $\mu$ or $$\frac{\partial x}{\partial\mu}$$ can be calculated as $$\frac{d}{dt}\left(\frac{\partial x}{\partial\mu}\right)=\frac{\partial f}{\partial x}\frac{\partial x}{\partial\mu}+\frac{\partial f}{\partial\mu}$$

so calling $\delta_{\mu}=\frac{\partial x}{\partial\mu}$ we have the sensitivity equation $$\dot{\delta}_{\mu}=\frac{\partial f}{\partial x}\delta_{\mu}+\frac{\partial f}{\partial\mu}$$

In the case of $$\dot{x}=x+\mu(t+x^{2}),\;x(0)=1$$

we have $$\begin{array}{rcl} \frac{\partial f}{\partial x} & = & 1+2\mu x\\ \frac{\partial f}{\partial\mu} & = & t+x^{2} \end{array}$$

and the final system to solve is $$\begin{array}{rcl} \dot{\delta_{\mu}} & = & (1+2\mu x)\delta_{\mu}+t+x^{2}, \; \delta_{\mu}(0) = 0\\ \dot{x} & = & x+\mu(t+x^{2}),\;x(0)=1 \end{array}$$

focusing the case of $\mu=0$ we have to solve $$\begin{array}{rcl} \dot{\delta}_{0} & = & \delta_{0}+t+x^{2}, \; \delta_0 = 0\\ \dot{x} & = & x,\;x(0)=1 \end{array}$$

NOTE

If

$$x(0) = g(\mu)\Rightarrow \delta_{\mu}(0) = \frac{\partial g}{\partial \mu}$$

• I've got a result that $x=e^t$ and $\delta _0 = e^{2t}-t-1$, am I right? Commented Jun 7, 2018 at 16:21
• Yes. You are right. Commented Jun 7, 2018 at 16:27