A string of uniform mass $M$ and total length $l$ is placed on a table. The length $h$ of the string is falling from the edge of the table. Find the velocity of the right end of the string that is on the table just before falling down.

(Wow !!! Thanks for the built-in image)

Let $x$ be the amount that string falls in time $\mathrm {dt}$

Now the mass per unit length $M_0 = M/l$

Mass of the part below table, = $M_0 (h+x)$ and above table = $M_0(l- (h+x))$

Since h part is pulling the above table part,

$$M_0a(l-(h+x)) = M_0g(h+x)$$

$$\implies a(l-(h+x)) = g(h+x)$$

$$a = g{h+x \over l-(h+x)}$$

$${dv\over dt} = g{h+x \over l-(h+x)}$$

$${dv\over dx}{dx \over dt} = g{h+x \over l-(h+x)}$$

$$v{dv\over dx} = g{h+x \over l-(h+x)}$$

$$v{dv} = g{h+x \over l-(h+x)}dx$$

$$\int_0^v v{dv} = \int_0^{l-h}g{h+x \over l-(h+x)}dx$$

$${v^2 \over 2} = \int_0^{l-h}g{h+x \over l-(h+x)}dx$$

Now I will do a u substitution that I never did before this,

Let $u = h + x$

${du\over dx} = {1} \implies du = dx$

$$\int_0^{l-h}{h+x \over l-(h+x)}dx = \int_0^{l-h}{u \over l-(u)}du$$

$$= -\int_0^{l-h}{-u \over l+(-u)}du = {u+l\log*e(\vert u-l\vert)\bigg\rvert*{0}^{l-h}}$$

$$ = {h+x+l\log*e(\vert h+x-l\vert)\bigg\rvert*{0}^{l-h}} ={h+l-h+l\log_e(\vert h+l-h-l\vert) -(h+0+l\log_e(\vert h+0-l\vert) )} $$

$$= l+l\log_e(\vert0\vert) -h-l\log_e(\vert h-l\vert) ) = {l -h +l(\text{undefined} -\log_e(\vert h-l\vert))}$$

$$v^2/2 = g(l -h +l(\text{undefined} -\log_e(\vert h-l\vert))$$

$$v = \sqrt{2g(l -h +l(\text{undefined} -\log_e(\vert h-l\vert))}$$

I think I did everything properly still I got "undefined" in my solution.

I think my intial integral itself is wrong.

Please help me with problem.