# Calculating the metric tensor

In my lecture we just approached the metric tensor and the general form of a scalar product. So for two vectors $$\vec{x}$$ and $$\vec{y}$$ the scalar product is

$$\vec{x} \cdot \vec{y} \enspace = \enspace g_{ij} \, x^i \, y^j$$

where $$g_{ij}$$ is the metric tensor. Now, I know that the components of the metric tensor are the scalar products of the basis vectors.

$$g_{ij} \enspace = \enspace \vec{g}_i \cdot \vec{g}_j$$

The question is: If i need to know the components of the metric tensor to calculate the scalar product, how do I calculate the components of the metric tensor, since they are obtained by scalar products themselves. Meaning, that if I try to calculate $$\vec{g}_i \cdot \vec{g}_j$$ I would need the metric tensor to calculate these, wouldn't I? How would I do this then?

The metric tensor, being a tensor, depends only on the space and not on the coordinate system. You can only get its components when you choose a coordinate system to describe the space. For example, both $$\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \text{and} \begin{bmatrix} 1 & 0 & 0 \\ 0 & r^2 & 0 \\ 0 & 0 & r^2 \text{sin}^2 \theta \end{bmatrix}$$ refer to the same tensor, which is flat Euclidean space. The only difference is that the former uses Cartesian coordinates while the latter uses spherical coordinates, and that's why we obtain different components.
The basis vectors are then $$\mathbf{e}_i = \frac{d}{dx^i}$$ which you can compute either geometrically or with the help of a Cartesian coordinate system. The components of the metric tensor are then obtained as the pairwise dot products.