Computing Equilibrium Bids in Single-Item Auctions
Arrays & HashingAuto-graded · 18 test casesLast updated
Tests understanding of dominant strategy equilibria in second-price auctions and Bayesian Nash equilibria in first-price auctions with uniform value distributions.
You are analyzing bidding strategies in single-item auctions with two participants. Your personal valuation for the item is v, where 0 < v < 1. The competing bidder has a valuation drawn uniformly at random from the interval [0, 1], and you know this distribution but not their actual value.
Compute the equilibrium bid for two auction formats:
Second-Price Auction (Vickrey):
- The participant submitting the higher bid wins the item
- The winner pays an amount equal to the losing bid (not their own bid)
- The loser pays nothing
- Your payoff if you win is your valuation minus the payment; if you lose, your payoff is zero
- Assume the opponent bids truthfully (submits their actual valuation)
First-Price Auction:
- The participant submitting the higher bid wins the item
- The winner pays their own bid
- The loser pays nothing
- Your payoff if you win is your valuation minus your bid; if you lose, your payoff is zero
- Assume both bidders follow the symmetric Bayesian Nash equilibrium strategy for this setting
Return a dictionary with two keys:
"second_price_bid": your optimal bid in the second-price format"first_price_symmetric_equilibrium_bid": your equilibrium bid in the first-price format
Constraints
0 < v < 1- Both bidders are risk-neutral (maximize expected payoff)
- Valuations are private and statistically independent
- Ties occur with probability zero under the continuous distribution
- All values are floats
Examples
Example 1
Input: compute_auction_bids(0.5)
Output: {'second_price_bid': 0.5, 'first_price_symmetric_equilibrium_bid': 0.25}
Example 2
Input: compute_auction_bids(0.1)
Output: {'second_price_bid': 0.1, 'first_price_symmetric_equilibrium_bid': 0.05}
Example 3
Input: compute_auction_bids(0.75)
Output: {'second_price_bid': 0.75, 'first_price_symmetric_equilibrium_bid': 0.375}
Example 4
Input: compute_auction_bids(0.99)
Output: {'second_price_bid': 0.99, 'first_price_symmetric_equilibrium_bid': 0.495}
Hints
Hint 1
In a second-price auction, consider what happens when you bid above or below your true value compared to different possible opponent bids.
Hint 2
For any opponent bid, analyze whether deviating from truthful bidding in the second-price format can improve your payoff.
Hint 3
In the first-price auction, the symmetric equilibrium bid function is linear in v. Use the indifference condition: at the equilibrium bid, you should be indifferent between winning at that bid and losing.
Worked solution
Hard Try it yourself first — then compare your approach, complexity and edge cases.
Approach
This problem requires finding optimal bidding strategies under two different auction mechanisms with incomplete information.
Second-Price Auction Analysis:
The key insight is that truthful bidding (submitting your actual valuation) is a dominant strategy. To see why, consider any alternative bid and compare outcomes across all possible opponent bids:
-
If the opponent bids less than your valuation: Bidding your true value wins the item and you pay the opponent's bid, giving positive surplus. Bidding higher also wins but doesn't change your payment. Bidding lower might cause you to lose when you could have profited.
-
If the opponent bids more than your valuation: Bidding your true value loses (payoff zero). Bidding higher might win, but you'd pay more than your valuation (negative surplus). Bidding lower still loses.
-
If the opponent bids exactly your valuation: The outcome is essentially the same regardless (zero surplus).
Since bidding truthfully maximizes or ties utility for every possible opponent bid, it weakly dominates all alternatives. Therefore, the optimal bid is simply your valuation v.
First-Price Auction Analysis:
Here the winner pays their own bid, creating an incentive to shade bids below true value. In the symmetric Bayesian Nash equilibrium where both bidders use the same strategy function b(v), we seek a function where no bidder wants to deviate.
For the uniform distribution case with two bidders, the equilibrium bid function is linear: b(v) = v/2. This comes from the indifference condition: at equilibrium, a bidder with value v bidding b wins with probability equal to the probability that the opponent's value (and thus their bid) is below b. With uniform values and the equilibrium strategy b(x) = x/2, if you bid b, you win when the opponent's value is less than 2b.
Expected utility is (v - b) * Pr(win) = (v - b) * min(2b, 1). Maximizing over b yields b = v/2 for v ≤ 1.
Complexity:
- Time: O(1) — just arithmetic operations
- Space: O(1) — constant storage for output dictionary
Solution
from typing import Dict
def compute_auction_bids(v: float) -> Dict[str, float]:
# Second-price auction: truthful bidding is a dominant strategy.
# For any opponent bid b, submitting v maximizes utility:
# - If b < v: bidding v wins and pays b, yielding v - b > 0
# - If b > v: bidding v loses (payoff 0), while winning would give v - b < 0
# - If b = v: outcome is the same regardless of small deviations
# Therefore bidding truthfully dominates all alternative bids.
second_price_bid = v
# First-price auction: in the symmetric Bayesian Nash equilibrium with
# two bidders having i.i.d. Uniform[0,1] valuations, each bidder with
# value v bids b(v) = v/2. This results from solving the first-order
# condition for maximizing expected utility given the opponent follows
# the same strategy. With risk neutrality and independent private values,
# the linear equilibrium bid function is b(v) = v/2.
first_price_symmetric_equilibrium_bid = v / 2
return {
"second_price_bid": second_price_bid,
"first_price_symmetric_equilibrium_bid": first_price_symmetric_equilibrium_bid,
}