In a plane we have distance between two points p = (p1, p2) and q = (q1, q2) (each point has two coordinates):

dist = SQRT((p1-q1)^2 + (p2-q2)^2)

In 3D (p = (p1, p2,p3) and q = (q1, q2, q3):

dist = SQRT((p1-q1)^2 + (p2-q2)^2 + (p3 - q3)^2)

Really, innert list for me represents a point with 3D coordinates. So, distance between two inner lists of tab1 and tab2 has sense. Difference between lists tab1 and tab2 - a bit strange. Basicly, this is just a sum of all distances between separate points. In this case you may run loops with different limits, in your case 3 and 5 correspondingly. But I'm not sure about interpretation...

Also, as I pointed above, distance between two point is a square root of a sum of individual coordinate deltas. Therefore you might need to get SQRT before summing distances for individual points...

OK, I might misunderstand your task...

```
List<List<double>> tab1 = new List<List<double>>();
tab1.Add(new List<double>(new double[]{3.3d,4.0d,5.5d}));
tab1.Add(new List<double>(new double[]{4.2,3.2,4.2}));
tab1.Add(new List<double>(new double[]{3.8,7.3,2.1}));
List<List<double>> tab2 = new List<List<double>>();
tab2.Add(new List<double>(new double[]{3.8, 7.3, 2.1}));
tab2.Add(new List<double>(new double[]{3.3, 4.0, 5.5}));
tab2.Add(new List<double>(new double[]{4.2, 3.2, 4.2}));
tab2.Add(new List<double>(new double[]{4.2, 3.2, 4.2}));
tab2.Add(new List<double>(new double[]{4.2, 3.2, 4.2}));
double sum2 = 0.0;
for (int idx1 = 0; idx1 < tab1[0].Count; ++idx1){ //all list in tab1 have same count
for (int idx2 = 0; idx2 < tab2[0].Count; ++idx2) //all list in tab2 have same count
{
double delta = (tab1 [idx1][idx2] - tab2[idx1][idx2]);
sum2 += (delta * delta);
}
}
```