# Equate two expressions and get an expression for a variable

I have two expressions:

Exp1: $\text{erfc}\left(\sqrt{\phi }\right)$

Exp2:$$\frac{\Gamma (k+1) \left(\frac{\sqrt{2 \pi } \Gamma \left(k-\frac{3}{2}\right)}{\left(\frac{1}{2 k-3}\right)^{3/2} \Gamma (k)}-8 \sqrt{\phi } \, _2F_1\left(\frac{1}{2},k;\frac{3}{2};\frac{2 \phi }{3-2 k}\right)\right)}{4 \sqrt{\pi } \sqrt{k-\frac{3}{2}} k \Gamma (k-0.5)}$$

Now I need to exract an expression for $\phi$, by equating both the expression. Can I do this in mathematica

(exp1[ϕ_] = Erfc[Sqrt[ϕ]]) // TraditionalForm


(exp2[k_, ϕ_] = Gamma[k + 1] (
(Sqrt[2 Pi] Gamma[k - 3/2]/((1/(2 k - 3))^(3/2) Gamma[k])) -
8 Sqrt[ϕ] Hypergeometric2F1[1/2, k, 3/2,
2 ϕ/(3 - 2 k)]))/
(4 Sqrt[Pi] Sqrt[k - 3/2] k Gamma[k - 1/2]) //


ContourPlot[
{exp1[ϕ] == exp2[k, ϕ], k == 31/20}, {ϕ, 0, 4}, {k, 1, 2},
AspectRatio -> 1/GoldenRatio,
PlotLegends -> {"exp1 == exp2", "k == 31/20"}]


Numerically solving for ϕ for a specific value of k

With[{k = 31/20},
NSolve[{exp1[ϕ] == exp2[k, ϕ], 0 < ϕ < 4}, ϕ]]

(*  {{ϕ -> 0.0383686}, {ϕ -> 2.87873}}  *)


Simple example to get the method:

a = x
b = 2 x^2 - 1

sol = Solve[a==b,x]


Gives

{{x -> -(1/2)}, {x -> 1}}


Select solution 1

sol[[1]]