Your notation is a little mixed up. Typically, we would write:
ds^2 = \sum_{u v} g_{uv} dx^u dx^v
where ds is the line element, sort of an infinitesimal length, and u, v range over the indices for your coordinate system, and g_{uv} is a component of the metric tensor in that coordinate system. There is no factor of 2, and it doesn't make sense to write g_{uv} (dt^2 - dx^2). u and v are dummy indices, while t and x are specific coordinates. It would make sense to write:
ds^2 = g_{tt} dt^2 + g_{xx} dx^2
using t and x as both the coordinates and the indices, or you can write it as:
ds^2 = g_{00} (dx^0)^2 + g_{11} (dx^1)^2
where x^0 \equiv t and x^1 \equiv x
Let's not prejudice ourselves by writing x and t, but instead start with arbitrary coordinates u and v. Then we can write it as a matrix problem:
ds^2 = \left( \begin{array} \\ du & dv \end{array} \right) \left( \begin{array} \\ g_{uu} & g_{uv} \\ g_{vu} & g_{vv} \end{array} \right) \left( \begin{array} \\ du \\ dv \end{array} \right) = g_{uu} du^2 + g_{uv} du dv + g_{vu} dv du + g_{vv} dv^2
Then the issue is to change coordinates from u, v to x, t via a transformation matrix K:
\left( \begin{array} \\ du \\ dv \end{array} \right) = \left( \begin{array} \\ K_{ut} & K_{ux} \\ K_{vt} & K_{vx} \end{array} \right) \left( \begin{array} \\ dt \\ dx \end{array} \right)
Then you want to choose K such that \tilde{g} \equiv K^T g K is diagonal (as a matrix equation), where K^T means the transpose of K. Then in terms of \tilde{g}, you have:
ds^2 = \left( \begin{array} \\ dt & dx \end{array} \right) \left( \begin{array} \\ \tilde{g}_{tt} & 0 \\ 0 & \tilde{g}_{xx} \end{array} \right) \left( \begin{array} \\ dt \\ dx \end{array} \right) = \tilde{g}_{tt} dt^2 + \tilde{g}_{xx} dx^2
Once the metric is diagonal, you can get it into the form: ds^2 = g_{tt} (dt^2 - dx^2) by just scaling x: x \rightarrow \frac{\sqrt{g_{tt}}}{\sqrt{-g_{xx}}} x
Note, that all of this is taking place at a single point. That is, you can always pick coordinates so that g_{xt} = 0 at a single point. I'm actually not sure if it's always possible to make the metric diagonal at every point.