Understanding the use of continuity and 'derivative change' in finding Green functions Below is a university question and the corresponding solution for which I do not understand small parts of: 
Question:

Show that the Green’s function for the range $x \ge 0$, satisfying $$\frac{\partial^2 G(x,z)}{\partial x^2}+G(x,z)=\delta(x-z)$$ with boundary conditions:$$G(x,z)=\frac{\partial G(x,z)}{\partial x}=0\quad\text{at}\quad x=0$$ is $$G(x,z)=\begin{cases}\cos z\sin x-\sin z\cos x, &\text{for} & x\gt z \\ 0 &\text{for} & x\lt z\end{cases}$$

Solution:

For $x \ne z$ 
  $$\frac{\partial^2 G(x,z)}{\partial x^2}+G(x,z)=0$$ with solution
  $$G(x,z)=\begin{cases}A(z)\sin x+B(z)\cos x, &\text{for} & x\lt z \\ C(z)\sin x+D(z)\cos x &\text{for} & x\gt z\end{cases}$$
  $$G(x=0,z)=0\implies B(z)=0$$ The derivative is (for $x\le z$)
  $$\frac{\partial G(x,z)}{\partial x}=A(z)\cos x$$
  Since this is zero at $x=0$, we conclude that $A(z)=0$. Hence, $$G(x,z)=0\qquad (x\lt z)$$
  $\color{red}{\mathrm{For}}$ $\color{red}{x\gt z,}$ $\color{red}{\text{we use continuity of}}$ $\color{red}{G(x,z)}$ $\color{red}{\mathrm{at}}$ $\color{red}{x=z,}$ $\color{red}{\mathrm{ie.}}$
  $$\color{red}{C(z)\sin z+D(z)\cos z=0\tag{1}}$$
  $\color{red}{\text{The first derivative changes by}}$ $\color{red}{1,}$ $\color{red}{\text{so since}}$ $\color{red}{G(x,z)=0}$ $\color{red}{\text{for}}$ $\color{red}{x\lt z,}$
  $$\color{red}{C(z)\cos z -D(z)\sin z=1\tag{2}}$$
  We can eliminate $D$ (or $C$) from equations $(1)$ and $(2)$:
  $$C(z)\cos z + C(z)\frac{\sin^2z}{\cos z}=1\tag{3}$$
  Multiplying equation $(3)$ by $\cos z$ gives $$C(z)\cos^2 z+C(z)\sin^2 z=\cos z$$ and since $\cos^2 z+\sin^2 z=1$,
  $$C(z)=\cos z$$ and we then find $$D(z)=-\sin z$$
  Thus,
  $$G(x,z)=\begin{cases}\cos z\sin x-\sin z\cos x, &\text{for} & x\gt z \\ 0 &\text{for} & x\lt z\end{cases}$$
  $\fbox{}$


I understand everything apart from the part marked red; 
Why is equation $\color{red}{(1)}$ equal to zero? What does this have to do with continuity?  
Also equation $\color{red}{(1)}$ has products: $C(z)\sin z$ and $D(z)\cos z$ since $C(z)$ and $D(z)$ are both functions of $z$. So why isn't the product rule being used to yield $$C'(z)\sin z + C(z)\cos z + D'(z)\cos z -D(z)\sin z\text{?}$$ 
Why is it that the "first derivative changes by $1$"?
 A: Those both follow from the definition of "Green's function".  Exactly what definition are you using?
You have $G(x, z)= 0$ for $x\lt z$ and $A(z)\cos(x)+ B(z) \sin (x)$ for $x\gt z$. It is required (part of the definition of "Green's function") that $G$ be continuous at $x = z$.  That means that the two 'parts' must match up at $x = z$.
The limit of $0$ as $x\to z$ is, of course, $0$.  Since $\cos(x)$ and $\sin(x)$ are continuous functions, the limit of $A(z)\cos(x)+ B(z)\sin(x)$, as $x\to z$ is $A(z)\cos(z)+ B(z)\sin(z)$. So we must have $A(z)\cos(z)+ B(z)\sin(z)= 0$.
The fact that the derivatives must change by "$1$" is also part of the definition of the "Green's function" (more generally, if the differential equation has some function $a(x)$ multiplying the highest derivative, the derivative must change by $\dfrac{1}{a(z)}$ at $x = z$).  
One of the simplest examples of a "Green's Function" is for a wire or string drawn taut between two points, $(0, 0)$ and $(L, 0)$, then "plucked".  The Green's function for that problem is the straight line from 
$(0, 0)$ to $(x, z)$ then another straight line from $(x, z)$ to $(L, 0)$.  The "broken line" is continuous where the two lines join and has fixed derivative there.  The actual wave motion is a sum of those broken line functions.
A: The Green (or Green's) function satisfies the partial differential equation 
$$\frac{\partial^2 G(x,z)}{\partial x^2}+G(x,z)=\delta(x-z) \tag 1$$
If $G$ were discontinuous at $x=z$, then its second derivative would result in a Dirac Doublet.  Inasmuch as the right-hand side of $(1)$ contains only the Dirac Delta, not the doublet, then $G$ is continuous. 
Next, we integrate $(1)$ with respect to $x$ from $z-\epsilon$ to $z+\epsilon$, where $0<\epsilon<z$.  Exploiting the continuity of $G$, we find that 
$$\begin{align}
\lim_{\epsilon\to0}\int_{z-\epsilon}^{z+\epsilon}\left(\frac{\partial^2 G(x,z)}{\partial x^2}+G(x,z)\right)\,dx&=\color{blue}{\lim_{\epsilon\to0}\left.\frac{\partial G(x,z)}{\partial x}\right|_{x=z+\epsilon}^{x=z+\epsilon}}\\\\
&=\lim_{\epsilon\to0}\int_{z-\epsilon}^{z+\epsilon}\delta (x-z)\,dx\\\\
&=\color{blue}{1}
\end{align}$$
which results in the second boundary condition.
