Deriving the Formula for Average Speed (Same distance). Let me start of by specifying the question:


A and B are two towns. Kim covers the distance from A to B on a scooter at 17Km/hr and returns to A on a bicycle at 8km/hr.What is his average speed during the whole journey.


I solved this problem by using the formula (since the distances are same):
$$ \text{Average Speed (Same distance)} = \frac{2xy}{x+y} = \frac{2\times17\times8}{17+8} =10.88 \text{Km/hr}$$
Now I actually have two questions:
Q1- I know that $$ Velocity_{Average}=  \frac{\Delta S }{\Delta T} $$
Now here does $$\Delta S$$ represent $$ \frac{S_2+S_1 }{2} \,\text{or}\, S_2-S_1 ?$$
Where S2 is the distance covered from point A to point B and S1 is the distance covered from point B to point A
Q2. How did they derive the equation:
$$ Velocity_{Average(SameDistance)} = \frac{2xy}{x+y} $$
Could anyone derive it by using 
$$ Velocity_{Average}=  \frac{\Delta S }{\Delta T} $$

If one traveled distance $d_k$ at speed $v_k$, this took time $t_k=\dfrac{d_k}{v_k}$. It took time $T=\sum\limits_kt_k$ to travel distance $D=\sum\limits_kd_k$ and the average speed $V$ solves $D=VT$, hence $$V=\frac{\sum\limits_kd_k}{\sum\limits_k\frac{d_k}{v_k}}.
$$
In the particular case when there are $n$ distances which are all equal, one gets $V=\dfrac{n}{\sum\limits_{k=1}^n\frac1{v_k}}$, or 
$$\frac1V=\frac1n\sum\limits_{k=1}^n\frac1{v_k}.
$$
