The value of double integral $\int _0^1\int _0^{\frac{1}{x}}\frac{x}{1+y^2}\:dx\,dy$? Given double integral is :
$$\int _0^1\int _0^{\frac{1}{x}}\frac{x}{1+y^2}\:dx\,dy$$

My attempt : 
We can't solve since variable $x$ can't remove by limits, but if we change order of integration, then 
$$\int _0^1\int _0^{\frac{1}{x}}\frac{x}{1+y^2}\:dy\,dx$$
$$\implies\int _0^1\int _0^{\frac{1}{x}}\frac{x}{1+y^2}\:dy\,dx = \frac{1}{2}$$


Can you explain in formal way, please?



Edit : This question was from competitive exam GATE. The link is given below on comments by Alex M. and Martin Sleziak(Thanks).  

Right way is:
$$\int\limits_0^1x\:dx\int\limits_0^\dfrac1x \dfrac{dy}{1+y^2} = \int\limits_0^1\arctan y\:\Biggl.\Biggr|_0^{\dfrac1x} x\:dx =\int\limits_0^1x\arctan \dfrac1x\:dx = \int\limits_0^1\left(\dfrac{\pi}2-\arctan x\right)x\:dx =$$$$ \left.\dfrac{\pi}2\dfrac{x^2}2\right|_0^1 -\int\limits_0^1\arctan x\: d\dfrac{x^2}2 = \dfrac{\pi}4-\left.\dfrac{x^2}2\arctan x\right|_0^1 +{\dfrac12\int\limits_0^1\dfrac{x^2}{1+x^2}\:dx} =$$$$ \dfrac{\pi}4-\dfrac{\pi}8 + \dfrac12\int\limits_0^1\left(1 - \dfrac1{1+x^2}\right)dx = \dfrac{\pi}8+\left.\dfrac12(x-\arctan x)\right|_0^1=\dfrac12$$
To change order of integral, you build the region of integration in the chart, where you can see that the region of integration is made up of a square and curved trapezoid, so:
$$\int\limits_0^1x\:dx\int\limits_0^\dfrac1x \dfrac1{1+y^2}\:dy = \int\limits_0^1 \dfrac1{1+y^2}\:dy\int\limits_0^1 x\:dx +  \int\limits_1^\infty \dfrac1{1+y^2}\:dy\int\limits_0^\dfrac1y x\:dx = $$$$ \arctan y\:\Biggl.\Biggr|_0^1\cdot\left.\dfrac{x^2}2\right|_0^1 + \int\limits_1^\infty \left.\dfrac{x^2}2\right|_0^\dfrac1y\dfrac1{1+y^2}dy = \dfrac{\pi}8 + \dfrac12\int\limits_1^\infty \dfrac1{1+y^2}\dfrac1{y^2}\:dy = $$$$\dfrac{\pi}8+\dfrac12\int\limits_1^\infty \left(\dfrac1{y^2}-\dfrac1{1+y^2}\right)\:dy = \dfrac{\pi}8+\dfrac12\left(-\dfrac1y-\arctan y\right)\Biggr.\Biggr|_1^\infty = \dfrac12$$
And this way of calculation does not seem more simple.
