The squared line element in any spacetime is given as $$ds^{2}=g_{ab}dx^{a}dx^{b}.$$ The use of tensors helps us to infer that the line element in some other frame would be $$ds'^{2}=g'_{ab}dx'^{a}dx'^{b}$$ where simply $dx'^{a}=\frac{\partial x'^{a}}{\partial x^{b}} dx'^{b}$.
My question is, in special relativity, there is further a condition on the line element that it should $$c^{2}(s-t)^{2}-(x_{1}-y_{1})^{2}-(x_{2}-y_{2})^{2}-(x_{3}-y_{3})^{2}=c^{2}(s'-t')^{2}-(x'_{1}-y'_{1})^{2}-(x'_{2}-y'_{2})^{2}-(x'_{3}-y'_{3})^{2}$$ which gives us the Lorentz transformations. How can we prove this condition using the postulates of special relativity? Also where and how do we employ the condition that the frames we are transforming to are inertial?