Diameter of any galaxy I've been trying to figure out how to find the diameter in kpc of any galaxy given that one knows the distance to it in Mpc (d) and also the angular diameter/size (A) in arcsec. I had a formula before to find the diameter of a planet: $D=\frac{2\pi dA}{360degrees}$ but this is only if the celestial object is round. Then I asked my friend who gave me another formula $D=d*10^6 *sin (\frac{A}{3600})$

My question is, is the second formula the correct one if I want to find the diameter of any galaxy no matter what shape it is or is there another one which I do not know of?
Given the angular diameter $a$ in radians and the distance $d$ in Mpc, you can get the actual diameter $D$ from:
$$D = d\tan{a}$$

Using the small angle approximation, you get:
$$D = da$$

$a$ is in radians, so to get the distance in Mpc from the angular diameter in arc seconds you'd need to convert the angle in arc seconds to the angle in radians: $a = \frac{2\pi A}{360\times3600}$, where the factor $3600$ is used to convert arc seconds to degrees, and $\frac{2\pi}{360}$ to convert from degrees to radians:

To get the diameter in kpc:
$$D = 1000\times d \frac{2\pi A}{360\times3600}$$
$$D = d \frac{\pi A}{648}$$
$$D \approx \frac{dA}{206} $$

where $d$ is in $\textrm{Mpc}$, $D$ is in $\textrm{kpc}$, and $A$ is in $\textrm{arcsec}$.

Here $D$ is the diameter for round objects (even for disk galaxies seen at an angle). If the object is not round then this would normally be the maximum diameter. 

[EDIT (see answer and comments from HDE 226868)] For irregular galaxies you may also need to have more information (viewing angle) to find the real maximum diameter of the galaxy. But that information is (I think) only available for galaxies in the local group.