<s>[INST] How do I calculate the electric field due to a uniformly charged semicircle? I want to find the y-component of the electric at a point $b$ on the x-axis due to a charged semicircle centred around the origin. 

I found $dq$ using
$$\frac{dq}{Q} = \frac{dθ}{π}$$
$$dq = \frac{Q}{π}dθ$$
And the distance $r$ from $dq$ to $b$ using cosine law
$$r^2 = a^2 + b^2 - 2abcosθ$$
Subbing this into $dE = \frac{kdq}{r^2}$ gives
$$dE = \frac{k\frac{Q}{π}}{a^2 + b^2 - 2abcosθ}dθ$$
Since I only want the y-component of the electric field, I multiplied the whole thing by sinθ and integrated to get
$$E_y = \int\frac{k\frac{Q}{π}sinθ}{a^2 + b^2 - 2abcosθ}dθ$$
$$E_y = \frac{kQ}{2πab}ln(\frac{a^2+b^2+2ab}{a^2+b^2-2ab})$$
The answer that I should be getting is 
$$E_y = \frac{2kQ}{\pi}\frac{1}{b^2-a^2}$$
 [/INST] Assume $b>a$, as shown in your diagram.
First, your given answer should be wrong. Because if we let $a\rightarrow 0$ and fix $b$, then the $y$-component should go to zero. But your answer goes to the Coulomb field of a point charge.
The $y$ component is not obtained by simple multiplication by $\sin\theta$.
You have
$$d\vec{E} = \frac{k\frac{Q}{π}}{(a^2 + b^2 - 2ab\cos \theta)^{3/2}}d\theta((b-a\cos\theta) \hat{i}+a\sin\theta \hat{j})$$
So the $y$ component is
$$dE_y = \frac{k\frac{Q}{π}}{(a^2 + b^2 - 2ab\cos\theta)^{3/2}}d\theta a\sin\theta$$
Then
$$E_y= kQ/\pi \int_0^\pi \frac{a\sin\theta d\theta}{(a^2+b^2-2ab\cos\theta)^{3/2}} $$
$$=\frac{kQ}{2\pi b} \int_0^\pi \frac{d(a^2+b^2-2ab\cos\theta)}{(a^2+b^2-2ab\cos\theta)^{3/2}}$$
$$=\frac{kQ}{\pi b}\left[(a^2+b^2-2ab\cos\theta)^{-1/2}\right]_\pi^0$$
$$=\frac{kQ}{\pi b}\left[(a^2+b^2-2ab)^{-1/2}-(a^2+b^2+2ab)^{-1/2}\right]$$
$$=\frac{kQ}{\pi b}\left[\frac{1}{b-a}-\frac{1}{b+a}\right]$$
$$=\frac{2kQ}{\pi}\frac{a}{b}\frac{1}{b^2-a^2}$$
If instead you have $a>b$, then the answer is
$$E_y=\frac{kQ}{\pi b}\left[\frac{1}{a-b}-\frac{1}{a+b}\right]$$
$$=\frac{2kQ}{\pi}\frac{1}{a^2-b^2}$$
</s>