Earlier quoted context omitted.
Why do you need to use a specific method to solve a problem? Especially with something broad like algebra, there are often many ways to solve a problem.
Because teacher on previous lesson tried to teach the class e.g about using derivatives to find extremas, and now he's testing whether you managed to learn it. his job is mainly to teach you stuff. Of course there are also tests where you can use anything you want as long as it is formally correct e.g leaving school exams, end of semester exams and many more... It's not the greatest approach but I guess it scales?
I see the role of a teacher as someone who helps you learn, rather than someone who only teaches you things.
If a student finds a particular method or approach easier to comprehend, shouldn't the teacher adapt to that rather than forcing you to use the "correct" method?
If a teacher is dogmatic in their approach, I would call that poor teaching.