Hello, The electric potential is defined as: $$ \phi(\vec{r}) = \int d^3r' \frac{\rho(\vec{r}')}{|\vec{r} - \vec{r}'|}. $$ My question is, for solving for the potential inside of a charged solid sphere (constant charge density) by using the above equation I get, $$ \frac{Q}{2R} \bigg( \frac{r^2}{R^2} - 3 \bigg). $$ When the result is actually the above multiplied by a minus sign. Is this because when we take the reference point to be infinity, that we apply a minus sign by convention? I just want to be sure exactly why the minus sign is introduced.
Assuming your total charge is +Q, at the r=R your potential is negative (-Q/R). We know outside the charge distribution the potential should decrease in magnitude like 1/r. Thus infinity is not your zero of potential. By analogy with the infinity is the zero of potential case, we know the potential should fall Q/R. So V(infinity) = -2Q/R. Whatever you did is strange since your potential at the center of your sphere is negative. If I'm surrounded by a bunch of positive charge, why should the potential at my location be negative?
Well this is the equation I get for inside the sphere, $$ 3q \bigg( \int_{\infty}^R \frac{1}{r^2} dr + \int_R^r r \,\, dr \bigg) $$ Which leaves me with the result stated. . .
I don't understand your equation. You have to evaluate the integral as given in your first posting: [tex]\phi(\vec{x})=\int_{\mathbb{R}^3} \frac{\rho(\vec{x}')}{|\vec{x}'-\vec{x}|}.[/tex] For your example of a homgeneously charged sphere you have [tex]\rho(\vec{x}')=\frac{3 Q}{4 \pi R^3} \Theta(R-|\vec{x}'|).[/tex] The integral is most easily performed in spherical coordinates with the polar axis in direction of [itex]\vec{x}[/itex], which gives [tex](\vec{x}'-\vec{x})^2=r'^2+r^2-2r r' \cos \vartheta'.[/tex] Here [itex]r=|\vec{x}|[/itex] and [itex]=r'=|\vec{x}'| and [itex]\vartheta'[/itex] is the polar angle. Then you have [tex]\phi(\vec{x})=\frac{3Q}{4 \pi R^3} \int_0^{2 \pi} \mathrm{d} \varphi' \int_0^{\pi} \mathrm{d} \vartheta' \int_0^R \mathrm{d} r' \; \frac{r'^2 \sin \vartheta'}{\sqrt{r^2+r'^2-2r r' \cos \vartheta'}}.[/tex] Now you can do the angular integrations first. The one over [itex]\varphi'[/itex] is trivial, just giving a factor [itex]2 \pi[/itex]. The one over [itex]\vartheta'[/itex] is done by substitution [itex]u=\sin \vartheta'[/itex]: [tex]\phi(\vec{x})=\frac{3Q}{2 R^3} \int_0^R \mathrm{d} r' \int_{-1}^1 \mathrm{d} u \frac{r'^2}{\sqrt{r^2+r'^2-2 r r' u}}=\frac{3Q}{2 R^3} \int_0^R \mathrm{d}r' \frac{r'}{r} (r+r'-|r-r'|).[/tex] The remaining integral must be evaluated separately for the cases [itex]r<R[/itex] and [itex]r>R[/itex]. For [itex]r<R[/itex] you have to split the integral in the region [itex]0 \leq r' \leq r[/itex] and [itex]r \leq r' \leq R[/itex], carefully evaluate the modulus and put the results together. The result is [tex]\phi(\vec{x})=\frac{Q}{2R^3} (3 R^2-r^2) \quad \text{for} \quad 0 \leq r \leq R.[/tex] For [itex]r>R[/itex] the integral is easy, because then always [itex]r'<r[/itex] and thus [itex]|r-r'|=r-r'[/itex]. This leads to [tex]\phi(\vec{x})=\frac{Q}{r} \quad \text{for} \quad r \geq R.[/tex] As you see, the potential is continuous at [itex]r=R[/itex] as it should be. Outside of the charge distribution, you get Coulomb's Law as if the whole charge is concentrated at the origin. This is true for any spherically symmetric charge distribution with compact support.
Ah I see now, I was going about it the wrong way it seems! Thank you very much @vanhees71 for the detailed solution, this clears up a lot of questions I had. Also, (just in case you want to edit your post) you should have [itex] u = \cos(\theta') [/itex]. And you missed a / on your itex command (or an itex command altogether).