Stabilized Variational Formulation For Direct Solution Of Inverse Problems In Heat Conduction And Elasticity With Discontinuities