To calculate gain, you divide the output signal magnitude by the input signal magnitude. For voltage gain in decibels (dB), the formula is GdB = 20 × log10(Vout / Vin). For power gain in decibels, the formula is GdB = 10 × log10(Pout / Pin). Linear gain is simply the raw ratio (Output / Input) without the logarithmic scaling.

Whether you are biasing a 2N3904 transistor, setting the feedback resistors on an OPA2134 op-amp, or measuring the output of a Mini-Circuits RF amplifier, mixing up the 10log and 20log multipliers or failing to track your milli-units will brick your design. Below is the complete mathematical framework, rearranged for reverse-engineering, followed by bench-tested worked examples.

The Core Gain Formulas and Symbol Definitions

Gain is fundamentally a dimensionless ratio when expressed in linear terms, but it takes on the decibel (dB) unit when expressed logarithmically. The distinction between voltage/current gain and power gain is critical: power is proportional to the square of voltage (P = V²/R). Because log(x²) = 2 × log(x), the voltage multiplier is 20, while the power multiplier is 10.

Table 1: Gain Formula Symbols and Definitions
Symbol Definition Standard Unit Notes / Assumptions
Av Linear Voltage Gain V/V (Dimensionless) Can be negative for inverting topologies.
Ap Linear Power Gain W/W (Dimensionless) Always a positive value ≥ 0.
GdB Gain in Decibels dB Negative dB indicates attenuation (loss).
Vout Output Voltage Volts (V) Must be same domain (RMS, Peak, or DC) as Vin.
Vin Input Voltage Volts (V) Must be same domain as Vout.
Pout Output Power Watts (W) or mW Assumes matched load unless specified.
Pin Input Power Watts (W) or mW Often expressed in dBm in RF systems.

The Primary Equations

  • Linear Voltage Gain: Av = Vout / Vin
  • Linear Power Gain: Ap = Pout / Pin
  • Voltage Gain (dB): GdB = 20 × log10(Vout / Vin)
  • Power Gain (dB): GdB = 10 × log10(Pout / Pin)

Rearranged Forms for Reverse Engineering

On the bench, you rarely just calculate forward. Usually, you have a target output and a known input, and you need to find the required gain, or you have a datasheet gain spec and need to predict the output voltage. Here are the algebraic rearrangements solving for every variable.

Solving for Voltage Variables

  • Find Vout (from dB): Vout = Vin × 10(GdB / 20)
  • Find Vin (from dB): Vin = Vout / 10(GdB / 20)
  • Find Vout (from Linear): Vout = Vin × Av
  • Find Vin (from Linear): Vin = Vout / Av

Solving for Power Variables

  • Find Pout (from dB): Pout = Pin × 10(GdB / 10)
  • Find Pin (from dB): Pin = Pout / 10(GdB / 10)
  • Find Pout (from Linear): Pout = Pin × Ap
  • Find Pin (from Linear): Pin = Pout / Ap

Worked Examples with Strict Unit Tracking

The most common point of failure in gain calculations is unit mismatch. If Vin is in millivolts and Vout is in volts, dividing them directly yields a ratio that is off by a factor of 1,000, resulting in a 60 dB error. Always normalize to base SI units (Volts, Watts) before executing the logarithm.

Example 1: Audio Preamplifier Voltage Gain

Scenario: You are testing a non-inverting op-amp stage built with an NE5532. You inject a 15 mVRMS sine wave at the input. Your oscilloscope reads 1.2 VRMS at the output. Calculate the linear voltage gain (Av) and the gain in decibels (GdB).

Step 1: Normalize units to Volts.

  • Vin = 15 mV = 0.015 V
  • Vout = 1.2 V (already normalized)

Step 2: Calculate Linear Gain (Av).

  • Av = Vout / Vin
  • Av = 1.2 V / 0.015 V
  • Av = 80 V/V

Step 3: Calculate Gain in Decibels (GdB).

  • GdB = 20 × log10(80)
  • GdB = 20 × 1.90309
  • GdB = 38.06 dB

Example 2: RF Low-Noise Amplifier (LNA) Power Gain

Scenario: You are cascading a Mini-Circuits MAR-6 RF amplifier. The datasheet specifies a typical gain of 18 dB. Your signal generator feeds an input power of -30 dBm into the 50-ohm system. Calculate the output power in dBm, and then convert it to milliwatts (mW). For a deeper look at RF power math, refer to the Mini-Circuits dBm application note.

Step 1: Calculate Output Power in dBm.

In the decibel domain, multiplication becomes addition. You simply add the gain (in dB) to the input power (in dBm).

  • Pout(dBm) = Pin(dBm) + GdB
  • Pout(dBm) = -30 dBm + 18 dB
  • Pout(dBm) = -12 dBm

Step 2: Convert dBm to milliwatts.

The formula for dBm is: P(mW) = 10(PdBm / 10)

  • P(mW) = 10(-12 / 10)
  • P(mW) = 10-1.2
  • P(mW) = 0.063 mW (or 63 μW)

Assumptions, Unit Traps, and Realistic Magnitudes

Formulas assume ideal conditions. Real-world circuits introduce parasitic capacitance, clipping, and impedance mismatches that warp your theoretical numbers.

When the Formulas Apply (and When They Don't)

  • Linear Region Assumption: The formulas assume the active device is operating in its linear region. If your op-amp is powered by ±5V rails and your calculation predicts a 12V output, the op-amp will clip at ~3.5V (due to headroom limits). Your measured gain will artificially collapse.
  • Impedance Matching: The equivalence between voltage dB and power dB (where a 20dB voltage gain equals a 20dB power gain) only holds true if the input and output impedances are identical. In RF systems (50Ω in/out), this is standard. In audio (high-Z input, low-Z output), voltage gain and power gain in dB will be vastly different numbers.

Unit Mistakes That Break the Math

Warning: The RMS vs. Peak-to-Peak Trap
If your oscilloscope reads Vpp (peak-to-peak) but your multimeter reads VRMS, your gain calculation will be wrong by a factor of 2.828 (which is 2√2). This introduces a 9 dB error. Always ensure both Vin and Vout are measured in the exact same domain (both RMS, both Peak, or both DC) before dividing.

Realistic Answer Magnitudes

If your calculation yields a number outside these typical ranges, double-check your decimal placement:

  • Op-Amp Open-Loop Gain: 100 dB to 130 dB (Av = 100,000 to 3,000,000 V/V).
  • Audio Preamp (Closed-Loop): 20 dB to 40 dB (Av = 10 to 100 V/V).
  • RF Low-Noise Amplifier (LNA): 15 dB to 25 dB.
  • Passive Attenuator (Loss): -3 dB to -40 dB (Negative gain).

For foundational theory on how these logarithmic scales map to human hearing and circuit behavior, the All About Circuits textbook chapter on Decibels provides excellent baseline context, while Texas Instruments' Op Amps for Everyone details how open-loop gain degrades at higher frequencies.

Frequently Asked Questions

How to calculate gain from a Bode plot?

A Bode plot displays gain (in dB) on the Y-axis and frequency (logarithmic Hz) on the X-axis. To calculate the linear gain at a specific frequency, locate the frequency on the X-axis, trace up to the magnitude curve, and read the dB value on the Y-axis. Convert that dB value back to linear using the formula Av = 10(GdB / 20). For example, if the plot shows 40 dB at 1 kHz, the linear voltage gain at 1 kHz is exactly 100 V/V.

How to calculate gain in dB when voltage is negative?

The logarithm of a negative number is undefined in real math. When dealing with inverting amplifiers (where Vout is 180 degrees out of phase with Vin, resulting in a negative linear gain), you must take the absolute value of the ratio before applying the log. The formula becomes GdB = 20 × log10(|Vout / Vin|). The inversion is a phase shift, not an amplitude reduction; a gain of -10 V/V is still +20 dB of magnitude gain.

How to calculate power gain if input and output impedances are different?

If Zin and Zout are not equal (common in audio and sensor interfaces), you cannot simply use the voltage ratio to find power gain. You must calculate the actual power at both nodes using P = V² / R. First, find Pin = (Vin)² / Zin. Next, find Pout = (Vout)² / Zout. Finally, apply the power gain formula: GdB = 10 × log10(Pout / Pin). This will yield a drastically different number than the voltage gain in dB.

How to calculate total gain of cascaded amplifier stages?

When amplifiers are wired in series (cascaded), the math is highly dependent on your format. If you are using linear gain, you multiply the individual stage gains together (Atotal = A1 × A2 × A3). If you are using decibels, you simply add the gains of each stage (Gtotal = G1 + G2 + G3). This additive property is the primary reason RF and audio engineers prefer the dB scale for system-level block diagrams.