I am looking at buying Mithral barding for an animal companion. It is a large, non-humanoid creature. I want to buy it full plate. Would the cost be 1500 (base cost of full plate) × 4 (large, nonhumanion surcharge) + 9000 (Mithral surcharge) = 15000 gp or (1500 + 9000) × 4 = 42000 gp?
Either, depending on how you want to purchase the item. Mithral Large Barding (it's large barding, only mithral!) is 15000 gp, while Large Mithral Barding (it's mithral barding, only large!)is 42000 gp. Their stats are otherwise identical. As a player, you should generally choose the best of a set of actions which are nonmechanically equivalent, so Mithral Large Barding is the way to go. In campaigns I run, the pointlessly more expensive versions of items are not generally available, unless I want to make a point about a region being mechanically backwards.
Thorough explanation for you confused peoples:
We start with an item, in this case Full Plate. When we consider Full Plate, there are lots of possible kinds of Full Plate to buy. We could buy spiked full plate. We could buy Large full plate. We could buy unusually shaped full plate. etc.
For the purposes of this explanation, we note that both mithral full plate and Large full plate are available for purchase, at different prices and with different stats.
Next we look mithral or Large full plate. Large full plate is still an item primarily composed of metal, and so it can benefit from being made of mithral, changing it's price and stats. Mithral full plate is still sized for a Medium creature, and so is eligible to instead be sized for a larger creature, changing its price and stats. The end result is that the stats of the two armor sets are identical, with the exception of cost.
The rules for modification of items always assume a "base item" that the augmented item is "similar to, except...". This is why the prices for such things are expressed as operators (+500, X3,-10%, etc.) rather than numbers. This presents a fundamental challenge for the application of multiple modifiers, which Pathfinder deals with by not allowing multiple modifications. All pathfinder mods of this nature apply their effects to a base item and result in a new item, which can then be further modified by using it as the input base item into another modifier. You can't apply these affects simultaneously, or both to some 'original' base item; that's not how the system works. Instead you have to calculate one modification and then use that as the base item for the other.
The FAQ addresses this conern
The rules would have the order of operations for computing the price of armor that's created from special materials be ((base item cost) + (special materials cost)) × any modification for Armor for Unusual Creatures.
Thus full plate (1,500 gp; 50 lbs.)) made of mithral (+9,000) for a Large nonhumanoid creature (therefore increasing its price by ×4) has a market price of 42,000 gp. I hope that the animal companion appreciates the master's indulgent purchase.
The Pathfinder RPG Core Rulebook Frequently Asked Questions addresses this issue here. It says, in part, the following:
Cost Multipliers for Items: When an item has a cost multiplier, for instance for its size, unusual shape, or composition, does that apply before or after additional costs such as… using a special material?
First add up the total cost of the base item, including any special material. Then multiply by any multiplier for the size and unusual shape from Table 6-8.… This means a mithral chain shirt built for a rune giant costs 8,800 gp and a mithral chain shirt built for the tarrasque costs 35,200 gp.…
This exchange was added to the FAQ in July 2017, after, for example, this 2015 thread received more than 200 votes from Paizo messageboard users wanting this exact issue clarified.
"That's really expensive!"
I know, right? For example, the game says that a cavalier for his mount could either buy mithral Large nonhumanoid full plate (43,000 gp; 50 lbs.) or get the same amount of protection from a +3 Large nonhumanoid breastplate (9,950 gp; 60 lbs.).
Of course, with truly staggering wealth the former armor's protection in combination with magic will outstrip the protection that can be afforded by the latter, but for the vast majority of animal aficionados and Large and bigger creatures in a traditional game, a savings of over 30,000 gp is enough to skip mithral completely and just go with more magic.
With this in mind, this GM has never had any issue with using instead the formula (base item cost × any modification for Armor for Unusual Creatures) + special materials cost. Therefore in this GM's campaigns mithral Large nonhumanoid full plate has a price of 15,000 gp ((1,500 ×4) +9,000), just like the alternative mentioned in the question.
The game's official higher prices may seem realistic—it just takes more mithral to make mithral full plate for a Huge giant than for a Diminutive sprite—, but to this GM that realism takes a backseat to the math unfairly punishing armor-wearing big creatures. My experience has been that special materials aren't better enough for Large and bigger humanoids and nonhumanoids to justify the way the game says to do this math.
Note: I should mention that in some Pathfinder campaigns investing in AC in a big way is, by mid-levels, a losing proposition as enemies' attack rolls outpace a defender's ability to dig up bonuses to AC. In such campaigns, enough AC to ignore low-level foes is a good idea, but eventually a miss chance will be better than any armor. Also, don't forget that somebody in the party may be able to cast the long-lasting and relatively-low-level spell magic vestment making purchased enhancement bonuses on armor sometimes redundant.