Cosmic string solution to general relativity I'm having a difficulty in finalizing a resolution of the Einstein equation for a static cosmic string.  I start with the following metric ansatz, for a static straight string oriented along the $z$ direction.  Using cylindrical coordinates:
$$\tag{1}
ds^2 = \mathcal{P}^2(r) \, dt^2 - dr^2 - \mathcal{Q}^2(r)\, d\vartheta^2 - dz^2.
$$
Plugging this metric into the Einstein equation gives the following equations, after a few pages of calculations (I'm using the $\eta = (1, -1, -1, -1)$ convention and $G_{ab} = -\, \kappa T_{ab}$.  Indices are associated to the "flat" local inertial frames):
\begin{align}
G_{00} &= \frac{\mathcal{Q}^{\prime \prime}}{\mathcal{Q}} = -\, \kappa T_{00} = -\, \kappa \rho, \tag{2} \\[1ex]
G_{11} &= -\, \frac{\mathcal{P}^{\prime} \mathcal{Q}^{\prime}}{\mathcal{P} \mathcal{Q}} = -\, \kappa T_{11} = 0, \tag{3} \\[1ex]
G_{22} &= -\, \frac{\mathcal{P}^{\prime \prime}}{\mathcal{P}} = -\, \kappa T_{22} = 0, \tag{4} \\[1ex]
G_{33} &= -\, \frac{\mathcal{P}^{\prime \prime}}{\mathcal{P}} - \frac{\mathcal{P}^{\prime} \mathcal{Q}^{\prime}}{\mathcal{P} \mathcal{Q}} - \frac{\mathcal{Q}^{\prime \prime}}{\mathcal{Q}} = -\, \kappa T_{33} = +\, \kappa \tau. \tag{5}
\end{align}
Here, $\rho > 0$ and $\sigma = -\, \tau < 0$ are the string's energy density and tension, respectively.  Now, (2) implies $\mathcal{Q}^{\prime} \ne 0$, so (3) and (4) give $\mathcal{P}^{\prime} = 0$ and $\mathcal{P}^{\prime \prime} = 0$.  Then (5) implies $\tau = \rho$, which is good for a relativistic string.  Then, the trouble begins when I attempt to solve (2).  I was expecting a thin string, so a Dirac's delta for the density $\rho$.  But (2) suggest another solution and I wasn't expecting this.  Assuming a constant density $\rho = \rho_0$ for $r < R$ (the string's radius) and $\rho = 0$ for $r > R$, I get
$$\tag{6}
\mathcal{Q}^{\prime \prime} + \kappa \rho_0 \, \mathcal{Q} = 0.
$$
Then this is an harmonic equation which have the general solution (I write $\lambda \equiv \sqrt{\kappa \rho_0}$ to simplify things)
$$\tag{7}
\mathcal{Q}(r) = \alpha \sin(\lambda r) + \beta \cos(\lambda r).
$$
For the exterior metric: $\rho = 0$, (2) reduces to $\mathcal{Q}^{\prime \prime} = 0$, which have solution $\mathcal{Q}(r) = a r + b$.  Matching the solution at $r = R$ gives
$$\tag{8}
\mathcal{Q}(R) = \alpha \sin(\lambda R) + \beta \cos{\lambda R} = a R + b.
$$
So my problem is to find the constants $\alpha$, $\beta$, $a$ and $b$ (four constants!), from regularity and junction conditions.

EDIT: From A.V.S and Michael answers below, I should apply the regularity at $r = 0$:
\begin{align}
\mathcal{Q}_{\text{int}}(0) &= 0, \tag{9} \\[1ex]
\mathcal{Q}_{\text{int}}^{\prime}(0) &= 1. \tag{10}
\end{align}
This gives $\alpha = \lambda ^{-1}$ and $\beta = 0$, so
$$\tag{11}
\mathcal{Q}_{\text{int}}(r) = \frac{1}{\lambda} \, \sin(\lambda r).
$$
This is fine.  But then I imposes the junction at the string's surface.  Apparently, there's a subtlety that I don't understand here.  According to some obscure papers I've found, the radial coordinate $r$ isn't the same on the interior side and on the exterior of the string, so $R_{\text{int}} \ne R_{\text{ext}}$:
\begin{align}
\mathcal{Q}_{\text{int}}(R_{\text{int}}) &= \mathcal{Q}_{\text{ext}}(R_{\text{ext}}), \tag{12} \\[1ex]
\mathcal{Q}_{\text{int}}^{\prime}(R_{\text{int}}) &= \mathcal{Q}_{\text{ext}}^{\prime}(R_{\text{ext}}). \tag{13}
\end{align}
This gives the following junction conditions:
\begin{align}
\frac{1}{\lambda} \, \sin(\lambda R_{\text{int}}) &= a R_{\text{ext}} + b, \tag{13} \\[1ex]
\cos(\lambda R_{\text{int}}) &= a. \tag{14}
\end{align}
I can't solve this system of equations without an extra constraint (??).  I get the relation of some paper if I impose $b = 0$ so
$$\tag{15}
R_{\text{ext}} = \frac{1}{\lambda} \, \tan(\lambda R_{\text{int}}).
$$
Defining the energy per unit length $\mu = \rho_0 A_{\text{int}}$, I get $a = 1 - 4 G \mu$, which relates to the angle deficit.
But how can I justify that $b = 0$ and that the radial coordinate isn't the same on both side of the string's surface?  Why can't I just use $R_{\text{int}} = R_{\text{ext}} = R$, and then find $a$ and $b \ne 0$ ?
An "obscure" paper that shows some details (with pesky weird notation!), without explaining the different radial coordinate and why $b$ should be 0.  See expressions (6), (7), (8), on page 2:
https://arxiv.org/abs/hep-th/0107026
See also pages 3 and 4 of this paper:
https://arxiv.org/abs/gr-qc/9508055
 A: First, to me it seems that the ansatz $(1)$ for this metric of thick  cosmic string is wrong, since for a general $\mathcal{P}(r)$ the metric lacks the $SO(1,1)$ invariance under boosts along the string direction, i.e. Lorentz transformations in $(t,z)$ plane.
My suggestion:
$$
\tag{1*}
ds^2 = \mathcal{P}^2(r) \,( dt^2 - dz^2) - dr^2 - \mathcal{Q}^2(r)\,d \vartheta^2 .
$$
Both OP's and my metrics reduce to the same thing if condition $\mathcal{P}\equiv 1 $ is imposed (which happens if stresses $T_{rr}$ and $T_{\theta\theta}$ are zero). However, if $\mathcal{P}$ varies with $r$ in OP's version this boost symmetry disappears. So OP's ansatz would not work for a thick string that is (for example) a solution of Einstein–Abelian Higgs system .
Second. The correct choice of constants is $\alpha=1/\lambda$, $\beta=0$ (while $b\ne 0$). This follows from

*

*the interpretation of $r$ as distance from symmetry axis (which would be $r=0$) along the radial direction (so at $r=0$ metric must have coordinate singularity, so $\mathcal{Q}(0)=0$);


*near the symmetry axis there must be no additional angle deficit. If $\alpha\ne 1/\lambda$ there would be a thin string inside the thick string!
The remaining constants $a$ and $b$ are obtained from the conditions of continuity of $\mathcal{Q}$ and $\mathcal{Q}'$ across the boundary $r=R$. If $\mathcal{Q}'$ jumps then this would correspond to nonzero surface stress–energy tensor of the cylinder.
As an interesting variation on the thick string I suggest the metric of a “relativistic solenoid”: the inside metric is Melvin spacetime (with  magnetic field along the $z$–axis) and with stress energy tensor depending on $r$ like this: $T^{\mu}_{\nu}=\rho(r)\,\mathop{\mathrm{diag}}(1,1,-1,-1)$, while outside it is flat spacetime with angle deficit. On the surface of a cylinder then there would be a current and distributional surface energy density and stresses. For such metric the function $\mathcal{P}(r)$ would not be constant.
A: As noted by @mmeent in the comments, the metric must be regular at the origin.  This means, in particular, that
$$
\mathcal{Q}(r) \approx r
$$
in the limit $r \to 0$.  Equivalently, we must have $\mathcal{Q}(0) = 0$ and $\mathcal{Q}'(0) = 1$.  In addition, the metric components and their first derivatives must be continuous at the boundary $r = R$.
We thus have four equations (two from regularity at the origin, two from continuity at the boundary) in the four unknowns $\alpha$, $\beta$, $a$, and $b$.  Take it from there.
