How to derive $ \frac ab -x= \frac {c-xd}{b}+\left(\frac{b-d}{b}\right) \left(\frac{a-c}{b-d} - x \right) $ $$ \frac ab -x= \frac {c-xd}{b}+\left(\frac{b-d}{b}\right) \left(\frac{a-c}{b-d} - x \right)  $$
It is easy to check it by computing right hand side. It feels unnatural and a little magical. I could't derive it starting from LHS
This identity is used in the proof of Stolz Cesaro theorem (https://ru.wikipedia.org/wiki/Теорема_Штольца). It is in russian I understood with the  help of google translate .
 A: Consider the task of cooking up a straight line by combining two other straight lines.  
Given a straight line $y=-x+a$
You want to represent this as a sum of two other straight lines.
Letting the slope of one line to $-m$ forces the slope of other line to  $-(1-m)$.
You can get that by comparing like terms in :
$$\color{red}{-x+a} = \color{blue}{-mx + c} - m'x+c'$$
Also constant term is $a-c$.
So above equation becomes
$$\color{red}{-x+a} = \color{blue}{-mx + c} + (1-m)\left(\dfrac{a-c}{1-m}-x\right)$$

Replacing $m$ with $\frac{d}{b}$ and $a$ with $\frac{a}{b}$ gives your identity.
A: Starting from the LHS
$$\frac{a}{b}-x$$
we can subtract and add $\frac{c-xd}{b}$ to form
$$\Big(\frac{a}{b}-x\Big) - \frac{c-xd}{b} + \frac{c-xd}{b}$$
which rearranges to
$$\frac{c-xd}{b}+\Big(\frac{a}{b}-x-\frac{c-xd}{b}\Big)$$
or
$$\frac{c-xd}{b}+\Big(\frac{a-c+xd}{b}-x\Big)$$
which is equivalent to
$$\frac{c-xd}{b}+\Big(\frac{a-bx-c+dx}{b}\Big)$$
where $\left(\frac{b-d}{b}\right) \left(\frac{a-c}{b-d} - x \right) = \Big(\frac{a-bx-c+dx}{b}\Big)$ and therefore we have the RHS
$$\frac{c-xd}{b}+\left(\frac{b-d}{b}\right) \left(\frac{a-c}{b-d} - x \right)$$
A: Let
$$
Z=\:\frac{\left(c-xd\right)}{b}+\left(\frac{b-d}{b}\right)\:\left(\frac{a-c}{b-d}\:-\:x\:\right)\:$$
Let
$$ K=\frac{\left(c-xd\right)}{b}$$
Let 
$$ N=\left(\frac{b-d}{b}\right)\:\left(\frac{a-c}{b-d}\:-\:x\:\right)\:$$
$$Z=K+N$$
We will rewrite $\left(\frac{a-c}{b-d}\:-\:x\:\right)\:$ as:
$$\left(\frac{a-c}{b-d}\:-\:x\:\right)\:=\left(\frac{a-c}{b-d}\:-\:x\:\frac{\left(b-d\right)}{\left(b-d\right)}\:\right)\:$$
$$N\:=\left(\frac{b-d}{b}\right)\left(\frac{a-c}{b-d}\:-\:x\:\frac{\left(b-d\right)}{\left(b-d\right)}\:\right)\:=\left(\frac{b-d}{b}\right)\left(\frac{a-c\:-x\left(b-d\right)}{b-d}\:\right)$$
$$N\:=\left(\frac{a-c\:-x\left(b-d\right)}{b}\:\right)$$
$$N\:=\left(\frac{a-c\:-xb+xd}{b}\:\right)$$
Using $Z=K+N$ and substituting the last expression for $N$ we get:
$$z\:=\frac{\left(c-xd\right)}{b}+\left(\frac{a-c\:-xb+xd}{b}\:\right) $$
$$z\:=\left(\frac{a\:-xb}{b}\:\right)$$
$$ z\:=\frac{a\:}{b}-x$$
