1. experiment with different methods/ways of doing something in order to find the correct/best one
figuring out how to operate the machine was a matter of trial and error
'Trial and error' refers to the process of trying and experimenting with different things and methods in order to arrive at the best approach, solution or outcome to something. Trial and error is a method of learning by doing. This is an expression that can be used in both social and professional contexts.