# How to find the change in a piecewise derivative at a given point?

If given some function (in this case it's a Green function but that's not important here as my question is much more simple) and you are given that it's derivative is $$\bbox[yellow]{\frac{\mathrm{d}}{\mathrm{d}x}G(x,x^{\prime}) = \begin{cases} A(x^{\prime})\cos x, & \text{for}\quad x\lt x^{\prime} \\ -B(x^{\prime})\sin x, & \text{for}\quad x\gt x^{\prime} \end{cases}}$$

Now you ask yourself $$\fbox{\color{blue}{\text{What is the Change in}\, \frac{\mathrm{d}G}{\mathrm{d}x}\text{at}\,x=x^{\prime}}\,\color{#F80}{\text{?}}}$$

The book answer says that:

The Change in $\dfrac{\mathrm{d}G}{\mathrm{d}x}$ at $x=x^{\prime}$ is $\color{red}{-B(x^{\prime})\sin x^{\prime} - A(x^{\prime})\cos x^{\prime}}$

I do not understand the logic behind the equation marked $\color{red}{\mathrm{red}}$. In other words; Why does subtraction of $A(x^{\prime})\cos x$ from $-B(x^{\prime})\sin x$ give the Change in $\dfrac{\mathrm{d}G}{\mathrm{d}x}$ at $x=x^{\prime}$?

Or, put in another way; Why is the Change in $\dfrac{\mathrm{d}G}{\mathrm{d}x}$ at $x=x^{\prime}$ not $\color{#180}{A(x^{\prime})\cos x^{\prime}-B(x^{\prime})\sin x^{\prime}}$ at $x=x^{\prime}$? Where I simply subtracted the functions the other way round. Why am I even subtracting in the first place? Why not add the functions together?

Any help will be greatly appreciated.

It is likely taken to mean that the change is relative to a unit impulse, at $x=x'$.

Formally, the derivative (here $dG/dx$) is singular at points of discontinuity of whatever underlying function. In other words, it is not defined.

You can however define it for practical purposes in such cases, to be the "signed" magnitude of the overall change (relative to some unit impulse spike), to have something to calculate with.

That's what the author probably means. Because time runs forward, the "signed" change in this case would measure "right and up", hence the red difference and not the green.

If you'd wanted to see it, it would look like this (for a positively oriented impulse, at $x=x0$). You can substitute your own $A$ and $B$ if needs be. (Note that $dG/dx$ at $x=1$ is not defined).

restart;
c1 := 1; c2 := -1;
A := proc (x) options operator, arrow; c1*sin(x)+c2*cos(x) end proc;
B := proc (x) options operator, arrow; -c1*cos(x)+c2*sin(x) end proc;
dGdx := proc (x, x0) options operator, arrow;
piecewise(x < x0, A(x0)*cos(x), x0 < x, -B(x0)*sin(x)) end proc;
with(plots);
plot(dGdx(x, 1), x = 0 .. 2, discont = true);