Mahesh Godavarti

You have to use the Biot-Savart Law.

The total magnetic field is given by B=\int_{ }^{ }\frac{\mu_0}{4\pi}.\frac{id\mathbf{l}\times\mathbf{r}}{r^3}. Note the vector cross product.

Where the integration is taking place over the entire length of the wire. This integration can be split into three parts.

\int_{\text{straight semi-infinite part 1}}^{ }\frac{\mu_0}{4\pi}.\frac{id\mathbf{l}\times\mathbf{r}}{r^3}+\int_{\text{semi-circle}}^{ }\frac{\mu_0}{4\pi}.\frac{id\mathbf{l}\times\mathbf{r}}{r^3}+\int_{\text{straight semi-infinte part 2}}^{ }\frac{\mu_0}{4\pi}.\frac{id\mathbf{l}\times\mathbf{r}}{r^3}

This becomes

2\int_{\text{straight semi-infinite part}}^{ }\frac{\mu_0}{4\pi}.\frac{id\mathbf{l}\times\mathbf{r}}{r^3}+\int_{\text{semi-circle}}^{ }\frac{\mu_0}{4\pi}.\frac{id\mathbf{l}\times\mathbf{r}}{r^3}

The first integral evaluates to \frac{\mu_0i}{\pi d} and the second integral evaluates to \frac{\mu_0 i}{2 d} . Giving a total of \frac{\mu_0i}{d}\left(\frac{1}{\pi}+\frac{1}{d}\right). This is the magnitude of the magnetic field. The direction is given by using the right hand thumb rule and the field is pointing into the paper (the direction of the field is determined by the direction in which the current is flowing).