By systematically and logically discovering the principles that underly an economy, economics explains how a market works, and how it can sometimes fail.
Microeconomics is the branch of economics that examines how an economy works at the individual (micro) level. It analyzes the actions of entrepreneurs (firms) that produce goods and services for trade in a market price system.
The results of the operations of the economy at the microeconomic level form the basis of macroeconomics which studies the economy as a whole at a collective, aggregate level (national and international level).
If macroeconomics can be said to study the forest than microeconomics examines the trees.