Marginal cost is the increase or decrease in total production cost if output is increased by one more unit. The formula to obtain the marginal cost is change in costs divided by change in quantity:
Marginal revenue is defined as the "increase in gross revenue by selling one additional unit of output".
If the price you charge (marginal revenue) per unit is greater than the marginal cost of producing one more unit, then you should produce that unit.
Above you can see as Avg Cost (AC2) dips, Price (P2) drops and Output (Q) goes up. As Demand (AR) stays the same, the result is a lower price and higher output
Reference: https://www.khanacademy.org/economics-finance-domain/microeconomics/firm-economic-profit/average-costs-margin-rev/v/marginal-revenue-and-marginal-cost