# Handling different kind of indices in single tensor equation

I want to solve the following differential equation,

$$\partial_a (\sqrt{h} \, h^{a b} \partial_b X^{i}) = 0$$

where $$X^i \equiv \{X^1(\sigma^1, \sigma^2), X^2(\sigma^1, \sigma^2), X^3(\sigma^1, \sigma^2) \},$$ $$\partial_a := \frac{\partial}{\partial \sigma^a},$$ $$h_{a b} \equiv \frac{\partial X^i}{\partial \sigma^a} \frac{\partial X^j}{\partial \sigma^a} \, \delta_{i j},$$ $$h := det(h_{ab})$$

Note that here $$a,b$$ indices run from 1 to 2, whereas the $$i, j$$ indices run from 1 to 3. I am struggling to write down the differential equation because I am not able to properly contract the $$a, b$$ indices.

Here is a code where I defined the quantities but failed to write down the equation.

         \[DoubleStruckCapitalX] = Table[X[i][\[Sigma][1], \[Sigma][2]], {i, 1, 3}];
\[DoubleStruckS] = Table[\[Sigma][a], {a, 1, 2}];
h[i_, j_] := D[\[DoubleStruckCapitalX], \[DoubleStruckS][[i]]] . D[\[DoubleStruckCapitalX], \[DoubleStruckS][[j]]]
\[DoubleStruckH] = ( {{h[1, 1], h[1, 2]}, {h[2, 1], h[2, 2]}} ) // FullSimplify;
Inverse[\[DoubleStruckH]] . \[DoubleStruckH] // FullSimplify // MatrixForm
Sqrt[Det[\[DoubleStruckH]]] // FullSimplify


Changing some symbol names for clarity of reading:

S = Table[Subscript[\[Sigma], a], {a, 1, 2}];
X = Table[Apply[Subscript[x, i], S], {i, 1, 3}];
H = Transpose[Grad[X, S]] . Grad[X, S]


I think this is the operator you are looking for. Note that we assume that the divergence is contracting the last index (i.e. deepest level) of the array V, which follows the Grad convention of adding an index at the end:

div[V_, S_, H_] := TensorContract[Grad[Sqrt[Det[H]] V . Inverse[H], S], ArrayDepth[V] + {0, 1}]


Then this is your Laplacian equation:

div[Grad[X, S], S, H] // Simplify