Trial and error is Reinforcement Learning. Machine Learning includes Supervised Learning, Unsupervised Learning, Self-Supervised Learning and Reinforcement Learning (these are types of problems). And any of these can be solved using Deep Learning or other methods.