Why are cost functions often assumed to be convex in microeconomics? Why are cost functions typically assumed to be convex in producer theory of (introductory) microeconomics?
For me this goes against the intuition of economies of scale. There are fixed costs (FC) which contribute to concavity of the cost function. There are also variable costs (VC) which may be concave, linear or convex. If we are on the concave part of VC, total costs (TC) must also be concave due to both FC and VC being concave. If we are in the linear part of VC, TC are again concave due to the concavity of FC. And if we are in the convex part of VC, TC may be either concave, linear or convex depending on the relative influence/weight of FC and VC on/in TC. However, even in the case where TC is convex, the producer does not have to operate that way. It can rather operate multiple copies of its production facility each at the level where TC is concave or linear to ensure the TC added over all production facilities is never convex.*,** This makes the assumption of convex costs suspect for me.
I do see one reason why convexity could occur, though. It is if resources are becoming scarce and the producer is big enough to influence the prices in the input markets. However, the producers are assumed to be small in perfect competition, yet their cost functions are assumed to be convex. This appears contradictory to me. So what am I failing to see?
*The fact that FC are incurred with each copy of the production facility might or might not make this a poor strategy depending on the relative weight of FC and VC.
**I think I borrowed the idea for this argument from Varian &quot;Microeconomic Analysis&quot;. In 3rd edition, Section 5.2 &quot;The geometry of costs&quot; p. 68 it says:

In the long run all costs are variable costs; in such circumstances increasing average costs seems unreasonable since a firm could always replicate its production process. Hence, the reasonable long-run possibilities should be either constant or decreasing average costs.

The cost function is also shown to be concave in the subsequent section 5.4 &quot;Factor prices and cost functions&quot;.

Edit: Thank you for all the great answers! It seems we can have different plausible stories with opposite implications. So far it seems one can plausibly argue for both convex and concave costs. The crux of the matter becomes the assumptions needed to make one story more plausible than the other. Thus the question is, what are the assumptions taken to make convex costs plausible (and concave costs implausible) in introductory microeconomics?
There are several reasons:

Didactic Reasons: Other users seem to have missed it but in your question you specify you are talking about &quot;(introductory) microeconomics&quot; [emphasis mine].
Well the most prosaic answer is simply that it is much easier to solve
cost minimization, or various other models when costs are assumed to
be convex.
This in itself is sufficient reason to construct problems with convex cost functions in introductory microeconomic courses. Demand and supply are not linear, yet in most textbooks and introductory problem they will be assumed to be linear. In addition, in real life demand can be sometimes even upward sloping if a good is a Giffen good, and supply can actually be downward sloping (e.g. some labor supply in some special cases depending on people's preference between consumption and leisure). Yet introductory textbooks typically show downward sloping demand and upward sloping supply (e.g. see Mankiw Principles of Economics that discusses these concepts but only briefly, or more narrowly micro introductory books such as Frank Microeconomics &amp; Behavior).
This is to a great degree for didactic reasons. It is much better for students to first master basics with simple models and when it comes to learning about costs having nicely behaved convex cost functions with single minimum makes learning easier than having to teach cost minimization with concave cost curves. Hence, even if empirically most cost curves would be concave not convex it would be very bad teaching practice to start with concave functions (or just go for full blown realism where cost functions might be piecewise, have different concavity/convexity at different points, be ill defined somewhere etc).

Because of Decreasing Returns to Scale - This was covered in great detail by Bayesian, but let me add more arguments and also rebuff some of your arguments in the question.
First, it is not unreasonable to assume that costs are convex in a long-run. In a world of scarcity firm cannot forever increase its demand for factors of production without affecting costs of these factors or inputs as well, their prices will rise eventually (ceteris paribus). We have crystal clear evidence that wages rise in tight labor markets, or that generally speaking shift in demand to the right (ceteris paribus) rises prices.
You argue that in perfect competition models firms are assumed to be small, but that is not a good argument in this case. This is because firms are assumed to be too small in terms of their output being able to affect market price of their output so price of output can be taken as given (See Frank Microeconomics and Behavior pp 337). Perfect competition does not require price of inputs to be taken as given. In fact, firm might operate on perfectly competitive market while facing just monopolistically competitive factor market (where the firm is consumer not producer).
Next, you argue that thanks to fixed costs one firms could just continuously invest in a new factories, but this argument should be false. A fix cost by definition cannot vary with output. If firm increases output by building new factory, the cost of factory ceases to be fixed costs. In fact fixed costs primarily exist in short-run as in a long-run most costs are variable (see Mankiw Principles of economics pp 260). In a long-run as you try to build more and more factories you run into the same problems of scarcity of land, capital and labor and thus bid up their prices. In fact this is nicely visualized and explained in the Mankiw textbook with the picture below:



Empirically, we observe that many industries have decreasing returns to scale (although constant returns to scale are common as well), and increasing returns to scale are rare (although not completely uncommon). See for example: Basu &amp; Fernald, 1997; Gao &amp; Kehrig 2017.
Introductory texts by their nature will not deal with specific cases but more general ones. Most introductory textbooks again do not spend too much time on Giffen goods not just because modeling them would be difficult for 101 students but also because they are not very often seen (although, I am not claiming non-convex cost functions are as rare as Giffen goods).

On the Aesthetics: I think Giskard raises a valid point that there are probably many economists who assume convex costs just for mathematical elegance. However:

I think Giskard slightly exaggerates the problem and is bit too cynical about it. For sure there are economists who value mathematical elegance uber ales, but there is increasing trend in share of empirical papers (see Angrist et al 2017), even in microeconomics, and I think that a reasonable non-cynical explanation for the small share of micro empirical papers is that until very recently there was always lack of good micro data (in addition this is also due to breakdown, you can see the share of industrial organization empirical papers (that also heavily use cost functions) is quite high).

Empirically, most industries do not exhibit increasing returns to scale. While non-convex functions are definitely real (especially along some points of cost curve), empirical evidence does show that decreasing returns to scale (although constant returns to scale as well) are quite common (e.g. see Basu &amp; Fernald, 1997; Gao &amp; Kehrig 2017), but I think Giskard has definitely valid point that some modelers will ignore empirics for sake of mathematical elegance.

Lastly, but not least, I think mathematical elegance can explain why such assumption features heavily in some published theoretical work, I don't think it can explain why it is featured in introductory micro texts. Is really quadratic cost function $c=q^2$ mathematically elegant? I don't think so but that is probably the most commonly used cost function you will ever see in intro texts.





Regarding the Varian quote. Varian on page 67 states that he will first cover situation with fixed factor costs and later move to variable factor costs. Hence, unless I am misreading Varian I think the statement on the page 68 is made under assumption of constant factor prices. However, the explanation above by Mankiw does not assume that.