Integral of $\frac{1}{y-x}$ in the direction of a line.
Solution 1:
That is not correct. You need to integrate the function along the curve and not just along $x$.
$y = \frac{x}{2} - 2 \implies \frac{dy}{dx} = \frac{1}{2}$
So the integral,
$ \displaystyle \int_C \frac{ds}{y-x} = \int_0^4 \frac{1}{-2 - x/2} \sqrt{1 + \left(\frac{dy}{dx}\right)^2} ~ dx$
$ \displaystyle = \frac{ \sqrt5}{2}\int_0^4 \frac{dx}{-2 - x/2} = - \sqrt 5 \ln 2$
Or you could parametrize the curve as,
$r(t) = (0, -2) + (1, \frac{1}{2}) t, 0 \leq t \leq 4$
$r'(t) = (1, \frac 12), |r'(t)| = \frac{\sqrt 5}{2}$
$y = - 2 + \frac{t}{2}, x = t$
Now the integral is $ ~ \displaystyle \int_0^4 f(r(t)) ~ |r'(t)| ~ dt ~ $ and you get the same answer as earlier.