Solving an equation that can be written in quadratic form - Problem type 1