(A) Let the $+q$ charge be displaced by a small distance $x$ from the midpoint $O$ towards one of the $-q$ charges.
The potential energy $U$ of the $+q$ charge due to the two $-q$ charges is given by:
$U = k \left[ \frac{(-q)(q)}{d-x} + \frac{(-q)(q)}{d+x} \right] = -kq^2 \left[ \frac{1}{d-x} + \frac{1}{d+x} \right]$
$U = -kq^2 \left[ \frac{d+x+d-x}{d^2-x^2} \right] = -\frac{2kq^2d}{d^2-x^2}$
To find the force,we differentiate $U$ with respect to $x$:
$F = -\frac{dU}{dx} = -\frac{d}{dx} \left( -2kq^2d (d^2-x^2)^{-1} \right) = -2kq^2d \left( (d^2-x^2)^{-2} \cdot 2x \right) = -\frac{4kq^2dx}{(d^2-x^2)^2}$
For equilibrium,$F = 0$,which implies $x = 0$.
To check stability,we find the second derivative of $U$ at $x=0$:
$\frac{d^2U}{dx^2} = \frac{d}{dx} \left( \frac{4kq^2dx}{(d^2-x^2)^2} \right) = 4kq^2d \left[ \frac{(d^2-x^2)^2 - x \cdot 2(d^2-x^2)(-2x)}{(d^2-x^2)^4} \right]$
At $x=0$,$\frac{d^2U}{dx^2} = 4kq^2d \left[ \frac{d^4}{d^8} \right] = \frac{4kq^2}{d^3} > 0$.
Since the second derivative of potential energy is positive at $x=0$,the potential energy is at a local minimum along the axis connecting the charges. However,the charge is in unstable equilibrium because it is in stable equilibrium along the axis but unstable perpendicular to it (Earnshaw's Theorem).