x[r_,t_,p_]=r Sin[t] Cos[p]
y[r_,t_,p_]=r Sin[t] Sin[p]
z[r_,t_,p_]=r Cos[t]

er=Simplify[{D[x[r,t,p],r],D[y[r,t,p],r],D[z[r,t,p],r]}]
et=Simplify[{D[x[r,t,p],t],D[y[r,t,p],t],D[z[r,t,p],t]}]
ep=Simplify[{D[x[r,t,p],p],D[y[r,t,p],p],D[z[r,t,p],p]}]

gij=FullSimplify[{{er.er,er.et,er.ep},{et.er,et.et,et.ep},{ep.er,ep.et,ep.ep}}]

m=FullSimplify[Inverse[Transpose[{er,et,ep}]] ]

m.D[er,r]
Out[18]= {0, 0, 0}
conclude: {x/rr} all zero

FullSimplify[m.D[er,t]]
             1
Out[20]= {0, -, 0}
             r
conclude: {t/rt}=1/r

FullSimplify[m.D[er,p]]
                1
Out[22]= {0, 0, -}
                r
conclude: {p/rp}=1/r

FullSimplify[m.D[et,t]]
Out[23]= {-r, 0, 0}
conclude: {r/tt}= -r

FullSimplify[m.D[et,p]]
Out[24]= {0, 0, Cot[t]}
colclude: {p/tp}=Cot[t]

FullSimplify[m.D[ep,p]]
                    2
Out[25]= {-(r Sin[t] ), -(Cos[t] Sin[t]), 0}
conclude: {r/pp}= -r Sin[t]^2   {t/pp}= -Cos[t] Sin[t]

gijk=ConstantArray[0,{3,3,3}];
Do[ Do[ Do[
gijk[[i,j,k]]=Switch[k,1,D[gij[[i,j]],r],2,D[gij[[i,j]],t],3,D[gij[[i,j]],p]],{k,3}],{j,3}],{i,3}]

gIJ=Inverse[gij]
Glik=ConstantArray[0,{3,3,3}];
Do[ Do[ Do[
sum=Sum[gIJ[[l,j]] (gijk[[i,j,k]]+gijk[[j,k,i]]-gijk[[k,i,j]]),{j,3}];
Glik[[l,i,k]]=FullSimplify[sum/2],{k,3}],{l,3}],{i,3}]

Glik[[1,All,All]]
                                                  2
Out[31]= {{0, 0, 0}, {0, -r, 0}, {0, 0, -(r Sin[t] )}}


Glik[[2,All,All]]                                                      
              1       1
Out[34]= {{0, -, 0}, {-, 0, 0}, {0, 0, -(Cos[t] Sin[t])}}
              r       r

Glik[[3,All,All]]
                 1                    1
Out[36]= {{0, 0, -}, {0, 0, Cot[t]}, {-, Cot[t], 0}}
                 r                    r

Glijk=ConstantArray[0,{3,3,3,3}];
Do[ Do[ Do[ Do [
Glijk[[l,i,j,k]]=Switch[k,1,D[Glik[[l,i,j]],r],2,D[Glik[[l,i,j]],t],3,D[Glik[[l,i,j]],p]],{k,3}],{l,3}],{j,3}],{i,3}]

Rdabc=ConstantArray[0,{3,3,3,3}];

Do[ Do[ Do[ Do [
sum1=Sum[Glik[[j,a,c]] Glik[[d,j,b]]-Glik[[j,a,b]] Glik[[d,j,c]],{j,3}];
Rdabc[[d,a,b,c]]=FullSimplify[sum1+Glijk[[d,a,c,b]]-Glijk[[d,a,b,c]] ],{a,3}],{b,3}],{c,3}],{d,3}]

---
m={er,et,ep} 
mp=FullSimplify[Inverse[m]]
MatrixForm[mp]
ap=ConstantArray[0,{4,4}]
ap[[1;;3,1;;3]]=mp
ap[[4,4]]=1    
MatrixForm[ap]
>                      Cos[p] Cos[t]        Csc[t] Sin[p]
                       -------------      -(-------------)
    Cos[p] Sin[t]            r                    r          0

                       Cos[t] Sin[p]      Cos[p] Csc[t]
                       -------------      -------------
    Sin[p] Sin[t]            r                  r            0

                         Sin[t]
                       -(------)
    Cos[t]                 r              0                  0



    0                  0                  0                  1


columns: 1: D[r, wrt x,y,z], 2: D[t, wrt x,y,z]
tuv=DiagonalMatrix[{a,b,c,d}]
guv=ConstantArray[0,{4,4}]
guv[[1;;3,1;;3]]=gij
guv[[4,4]]=-1    

tuvp=Transpose[ap].tuv.ap
FullSimplify[Tr[tuvp.guv]]

