Question: Let $f:[a,b]\to\mathbb{R}$ be continuous on $[a,b]$, differentiable on $(a,b)$ and let $f(x)\neq 0$ for every $x\in(a,b)$. Show that there exists $\theta\in(a,b)$ such that $$\frac{f'(\theta)}{f(\theta)}=\frac{1}{a-\theta}+\frac{1}{b-\theta}.$$
Solution: Let $g:[a,b]\to\mathbb{R}$ be such that $$g(x)=(a-x)(b-x)f(x), \forall x\in[a,b].$$ Note that $g$ is continuous on $[a,b]$ and differentiable on $(a,b)$ with $$g'(x)=-(b-x)f(x)-(a-x)f(x)+(a-x)(b-x)f'(x)\\=(a-x)(b-x)f'(x)-f(x)((a-x)+(b-x)), \forall x\in(a,b).$$
Now note that $g(a)=g(b)=0$. Thus, by applying Rolle's theorem to $g$ on the interval $[a,b]$, we can conclude that $\exists \theta\in(a,b)$ such that $g'(\theta)=0$, that is $$(a-\theta)(b-\theta)f'(\theta)-f(\theta)((a-\theta)+(b-\theta))=0\\\implies \frac{f'(\theta)}{f(\theta)}=\frac{1}{a-\theta}+\frac{1}{b-\theta}.$$ Hence, we are done.
Is this solution correct and rigorous enough and is there any other alternative way to solve the problem?