On ostrowski's generalization of sylvester's law of inertia