Cost analysis refers to studying how costs change with production levels and other economic factors. Costs are classified as explicit or implicit, and by their behavior as fixed, variable, or semi-variable. In the short run, average and marginal costs decrease initially as output rises due to efficiencies, but average costs eventually increase due to diminishing returns. In the long run, all factors are variable and average costs decrease with larger scale until an optimal size is reached.