The function given in the problem is:
$$f(x) = \sin^{-1}\left(\frac{2x}{1+x^2}\right) + 2\tan^{-1}(x)$$
To solve this problem, we need to transform the inverse sine term $$\sin^{-1}\left(\frac{2x}{1+x^2}\right)$$ into an inverse tangent term so that the entire expression becomes a function of inverse tangent ($$\tan^{-1}(x)$$). Since the principal value branch of $$\sin^{-1}(\theta)$$ restricts its output to $$\left[-\frac{\pi}{2}, \frac{\pi}{2}\right]$$, this conversion must be handled piecewise using substitution.
Step 1: Detailed derivation of the piecewise conversion
Let $$x = \tan\theta$$. Since $$x$$ ranges over all real numbers $$(-\infty, \infty)$$, our substitution angle $$\theta$$ is bounded strictly within the principal range of the arctangent function:
$$\theta = \tan^{-1}(x) \implies -\frac{\pi}{2} < \theta < \frac{\pi}{2}$$
Substituting this into the argument of the inverse sine term gives:
$$\frac{2x}{1+x^2} = \frac{2\tan\theta}{1+\tan^2\theta} = \sin 2\theta$$
Thus, the term simplifies to:
$$\sin^{-1}\left(\frac{2x}{1+x^2}\right) = \sin^{-1}(\sin 2\theta)$$
Since the domain of $$\theta$$ is $$\left(-\frac{\pi}{2}, \frac{\pi}{2}\right)$$, the double angle $$2\theta$$ spans across:
$$- \pi < 2\theta < \pi$$
Because this interval exceeds the standard principal value interval of the arcsine function, which is limited to $$\left[-\frac{\pi}{2}, \frac{\pi}{2}\right]$$, we must split the domain of $$x$$ into three separate intervals to resolve the expression properly.
Case A: When $$-1 \le x \le 1$$
Taking the arctangent across the inequality bounds gives:
$$\tan^{-1}(-1) \le \tan^{-1}(x) \le \tan^{-1}(1) \implies -\frac{\pi}{4} \le \theta \le \frac{\pi}{4}$$
Multiplying all parts by $$2$$ yields:
$$-\frac{\pi}{2} \le 2\theta \le \frac{\pi}{2}$$
Since the angle $$2\theta$$ already lies safely inside the principal value interval of the inverse sine function, the functions cancel out directly:
$$\sin^{-1}(\sin 2\theta) = 2\theta = 2\tan^{-1}(x)$$
Case B: When $$x > 1$$
We explicitly track the boundaries for this interval. Taking the arctangent yields:
$$\tan^{-1}(x) > \tan^{-1}(1) \implies \frac{\pi}{4} < \theta < \frac{\pi}{2}$$
Multiplying by $$2$$ pushes the angle beyond the upper principal boundary line:
$$\frac{\pi}{2} < 2\theta < \pi$$
To bring this angle back into the principal value domain of inverse sine without altering its sine value, we use the trigonometric identity $$\sin(2\theta) = \sin(\pi - 2\theta)$$. Checking the new boundaries for this shifted angle:
$$\frac{\pi}{2} < 2\theta < \pi \implies -\pi < -2\theta < -\frac{\pi}{2} \implies 0 < \pi - 2\theta < \frac{\pi}{2}$$
Since the angle $$(\pi - 2\theta)$$ sits securely inside the principal interval of $$\left[-\frac{\pi}{2}, \frac{\pi}{2}\right]$$, we can safely extract it:
$$\sin^{-1}(\sin 2\theta) = \sin^{-1}(\sin(\pi - 2\theta)) = \pi - 2\theta = \pi - 2\tan^{-1}(x)$$
Case C: When $$x < -1$$
We explicitly track the boundaries for this interval. Taking the arctangent yields:
$$- \frac{\pi}{2} < \theta < -\frac{\pi}{4} \implies -\pi < 2\theta < -\frac{\pi}{2}$$
To shift this back into the principal domain, we apply the trigonometric identity $$\sin(2\theta) = \sin(-\pi - 2\theta)$$. Checking the boundaries for this shifted angle:
$$-\pi < 2\theta < -\frac{\pi}{2} \implies \frac{\pi}{2} < -2\theta < \pi \implies -\frac{\pi}{2} < -\pi - 2\theta < 0$$
Since the angle $$(-\pi - 2\theta)$$ sits inside the safe principal zone of $$\left[-\frac{\pi}{2}, \frac{\pi}{2}\right]$$, we can extract it:
$$\sin^{-1}(\sin 2\theta) = \sin^{-1}(\sin(-\pi - 2\theta)) = -\pi - 2\theta = -\pi - 2\tan^{-1}(x)$$
Step 2: Construct the complete piecewise function f(x)
Now we combine these simplified inverse expressions from Case A, Case B, and Case C with the remaining component of our original function, $$2\tan^{-1}(x)$$:
Under Case C (For $$x \le -1$$):
$$f(x) = \left(-\pi - 2\tan^{-1}(x)\right) + 2\tan^{-1}(x) = -\pi$$
Under Case A (For $$-1 \le x \le 1$$):
$$f(x) = 2\tan^{-1}(x) + 2\tan^{-1}(x) = 4\tan^{-1}(x)$$
Under Case B (For $$x \ge 1$$):
$$f(x) = \left(\pi - 2\tan^{-1}(x)\right) + 2\tan^{-1}(x) = \pi$$
Step 3: Evaluate global extrema and equation solutions
We evaluate the global behavior of $$f(x)$$ across all structural intervals to compute our values:
The absolute maximum value of the function is $$M = \pi$$.
The absolute minimum value of the function is $$m = -\pi$$.
To find the number of distinct roots $$k$$ where $$f(x) = \frac{\pi}{2}$$, we scan our broken down cases:
In Case C ($$x \le -1$$), $$f(x) = -\pi \neq \frac{\pi}{2}$$.
In Case B ($$x \ge 1$$), $$f(x) = \pi \neq \frac{\pi}{2}$$.
In Case A ($$-1 \le x \le 1$$), the target equation value can only be achieved inside the variable middle range:
$$4\tan^{-1}(x) = \frac{\pi}{2} \implies \tan^{-1}(x) = \frac{\pi}{8} \implies x = \tan\left(\frac{\pi}{8}\right)$$
Since $$\tan\left(\frac{\pi}{8}\right) \approx 0.414$$ falls perfectly inside the boundary domain of Case A ($$[-1, 1]$$), this yields exactly $$1$$ distinct real solution. Thus, $$k = 1$$.
Step 4: Compute the value of the target expression
Substitute our parameters into the final structural formula:
$$\text{Value} = \frac{M - m}{k\pi} = \frac{\pi - (-\pi)}{1 \cdot \pi} = \frac{2\pi}{\pi} = 2$$