When the temperature is increases by $$\triangle \theta $$ then will elongation in rod and compression in spring.
At increased temperature the length of rod $$U$$ will be
$$l= l_{o}+ \triangle l$$
$$l= l_{o}+ l_{o} \alpha \triangle \theta$$
If the rod is elongated by amount $$\triangle x$$ then the net compression in the rod $$= l- (l_{o}+\triangle x)$$
$$=l_{o}+ l_{o} \alpha \triangle \theta - l_{o}- \triangle x$$
$$= l_{o} \alpha \triangle \theta - \triangle x$$
$$\Rightarrow $$ Strain (in rod) $$=\dfrac{l_{o} \alpha \triangle \theta - \triangle x}{l}$$
If the force exerted by rad on spring
$$F_{r}$$ and force exerted log $$s$$ bring is $$F_{s}$$ at point $$B$$.
then,
$$F_{r}= F_{s}$$
Since,
the compression in string $$=$$ elongation in rod $$= \triangle x$$
$$\Rightarrow F_{s}= k \triangle x$$
and,
we know that in red the youngs modulus
$$y= \dfrac{Stream}{Strain}$$
in $$Y=\dfrac{Fr/A}{(l_{o} \angle \triangle \theta - \triangle x)/l}$$
Where,
$$A \rightarrow $$ cross sectional area of rod
$$\Rightarrow F_{r}= \dfrac{AY (l_{o} \alpha \triangle \theta - \triangle x)}{l}$$
Since, $$F_{r}= F_{s}$$
$$\Rightarrow \dfrac{AY(l_{o} \alpha \triangle \theta - \triangle x)}{l}= k \triangle x$$
$$\Rightarrow AY l_{o} \alpha \triangle \theta - AY \triangle x= k \triangle x l$$
$$\Rightarrow \triangle x (k l + AY)= AY l_{o} \alpha \triangle \theta $$
$$\triangle x= \dfrac{AY l_{o} \alpha \triangle \theta }{k (l_{o}+ \triangle l)+ AY}= \dfrac{A Y l_{o} \alpha \triangle \theta }{k l_{o} \left[ \left(2+ \dfrac{\triangle l}{l_{o}} \right)+ \dfrac{AY}{l_{o}} \right]}$$
Assuming thermal strain $$\left( \dfrac{\triangle l}{l_{o}} \right)$$ to be negligible
$$\triangle x=\dfrac{AY \alpha \triangle \theta }{k+ \dfrac{AY}{l_{o}}}$$