Computer Networks Formulas – Complete Quick Reference Sheet

Home
CS & IT
Computer Networks
Formulas & Quick Reference
What You Will Find Here: Every key formula used in Computer Networks — bandwidth-delay product, propagation delay, throughput, subnetting, TCP window size, Shannon capacity, and more. Each formula is explained with a brief note on when to use it and a worked example.

1. Transmission & Propagation Delay

When you send a file across a network, two independent delays add up before the last bit reaches the destination.

Transmission Delay

Time to push all bits of the packet onto the wire.

Transmission Delay (Tt) = L / B
L = packet size in bits  |  B = link bandwidth in bps

Example: A 1 MB file (8 × 106 bits) on a 100 Mbps link:
Tt = 8,000,000 / 100,000,000 = 0.08 s = 80 ms

Propagation Delay

Time for one bit to travel from sender to receiver through the medium.

Propagation Delay (Tp) = D / V
D = distance in metres  |  V = propagation speed (~2 × 108 m/s in copper, ~3 × 108 m/s in fibre/air)

Example: 3000 km fibre link: Tp = 3,000,000 / 3×108 = 10 ms

Total End-to-End Delay (store-and-forward)

Total Delay = n × Tt + Tp
n = number of links (each router stores the full packet before forwarding)

Bandwidth-Delay Product (BDP)

BDP tells you how many bits are “in flight” in the network at any moment — useful for sizing TCP buffers.

BDP = Bandwidth × Round-Trip Time

Example: 100 Mbps link, RTT = 100 ms: BDP = 108 × 0.1 = 107 bits = 10 Mb

2. Throughput & Efficiency

Efficiency

Efficiency = Throughput / Bandwidth
Efficiency = Tt / (Tt + 2Tp)  (for stop-and-wait)

Stop-and-Wait Efficiency

With stop-and-wait, the sender waits for an ACK before sending the next packet. Let a = Tp / Tt:

EfficiencySW = 1 / (1 + 2a)

When propagation delay is large relative to transmission delay (a >> 1), efficiency collapses — this is why sliding window protocols exist.

3. Channel Capacity — Shannon & Nyquist

Shannon’s Theorem (noisy channel)

The theoretical maximum data rate for a channel with noise:

C = B × log2(1 + SNR)
C = capacity in bps  |  B = bandwidth in Hz  |  SNR = signal-to-noise ratio (linear, not dB)

SNR conversion: SNRdB = 10 × log10(SNRlinear)

Example: 3 kHz telephone channel, SNR = 1000:
C = 3000 × log2(1001) ≈ 3000 × 10 = 30 kbps

Nyquist’s Theorem (noiseless channel)

C = 2B × log2(M)
M = number of signal levels

Example: 3 kHz channel, 8 signal levels: C = 2 × 3000 × log2(8) = 6000 × 3 = 18 kbps

4. Error Detection — Hamming Distance

Hamming Distance

The number of bit positions where two codewords differ.

d(x, y) = number of bit positions where x and y differ

Error Detection vs Correction

To detect up to e errors: dmin ≥ e + 1
To correct up to e errors: dmin ≥ 2e + 1

Hamming Code — Number of Parity Bits

For a message of m data bits, the number of parity bits r must satisfy:

2r ≥ m + r + 1

Example: m = 4 data bits: try r = 3 → 23 = 8 ≥ 4 + 3 + 1 = 8. So r = 3 parity bits, total codeword = 7 bits.

CRC — Key Relationship

Remainder = (Message × xr) mod Generator
r = degree of generator polynomial (number of parity bits appended)

5. Sliding Window Protocols

Sliding window allows the sender to have multiple unacknowledged frames in transit at once.

Window Size for 100% Efficiency

Window Size W ≥ 1 + 2a   where a = Tp/Tt

Efficiency with Window Size W

If W ≥ 1 + 2a: Efficiency = 1 (100%)
If W < 1 + 2a: Efficiency = W / (1 + 2a)

Sequence Number Bits

ProtocolWindow SizeSequence Numbers NeededBits Required
Stop-and-Wait121
Go-Back-NWsWs + 1 (at minimum)n bits → Ws = 2n − 1
Selective RepeatWs2 × Wsn bits → Ws = 2n−1

Throughput

Throughput = Efficiency × Bandwidth

6. ALOHA Throughput

Pure ALOHA

S = G × e−2G
S = throughput (fraction of capacity)  |  G = offered load

Maximum throughput = 1/(2e) ≈ 18.4% at G = 0.5

Slotted ALOHA

S = G × e−G

Maximum throughput = 1/e ≈ 36.8% at G = 1

7. IP Subnetting & CIDR

Subnet Mask Basics

Number of hosts per subnet = 2h − 2
h = number of host bits  |  subtract 2 for network address and broadcast address

CIDR Notation

192.168.1.0/24 means 24 network bits, 8 host bits
Hosts = 232−24 − 2 = 28 − 2 = 254 usable hosts

Number of Subnets

Subnets = 2s   where s = subnet bits borrowed from host portion

Common Subnet Quick Reference

CIDRSubnet MaskHostsBlock Size
/30255.255.255.25224
/29255.255.255.24868
/28255.255.255.2401416
/27255.255.255.2243032
/26255.255.255.1926264
/25255.255.255.128126128
/24255.255.255.0254256
/16255.255.0.065,53465,536

Routing — Longest Prefix Match

When a router has multiple matching routes, it always picks the one with the longest (most specific) prefix.

8. TCP — Window, RTT & Throughput

TCP Throughput

TCP Throughput = Window Size / RTT
Window Size in bytes, RTT in seconds → throughput in bytes/sec

RTT Estimation (Jacobson’s Algorithm)

SRTT = (1 − α) × SRTT + α × RTTsample
DevRTT = (1 − β) × DevRTT + β × |RTTsample − SRTT|
TimeoutInterval = SRTT + 4 × DevRTT
Typical: α = 0.125, β = 0.25

TCP Slow Start & Congestion Avoidance

Phasecwnd GrowthTrigger
Slow StartDoubles each RTT (exponential)Start / after timeout
Congestion Avoidance+1 MSS per RTT (linear)cwnd ≥ ssthresh
Fast RecoveryLinear after triple duplicate ACK3 duplicate ACKs

TCP Maximum Segment Size (MSS)

MSS = MTU − IP header − TCP header = 1500 − 20 − 20 = 1460 bytes
(for standard Ethernet MTU of 1500 bytes)

TCP Sequence Number Space

Sequence numbers: 0 to 232 − 1 (32-bit field)
ACK number = next expected byte

9. Application Layer — Key Numbers

ProtocolPortTransportKey Detail
HTTP80TCPStateless; persistent vs non-persistent connections
HTTPS443TCPHTTP over TLS/SSL
DNS53UDP (queries) / TCP (zone transfers)Hierarchical; TTL controls caching
FTP21 (control), 20 (data)TCPTwo separate connections
SMTP25TCPSending mail; push protocol
POP3110TCPDownload and delete from server
IMAP143TCPSync, keep on server
DHCP67 (server), 68 (client)UDPDORA process
Telnet23TCPUnencrypted remote login
SSH22TCPEncrypted remote login
SNMP161UDPNetwork management

HTTP RTT Formula (Non-Persistent)

Total time = 2 RTT + Tt(file)   per object
1 RTT for TCP handshake + 1 RTT for HTTP request/response + file transmission time

HTTP RTT Formula (Persistent with Pipelining)

Total time = 2 RTT + Tt(all objects)   (one handshake, then pipeline)

10. Quick Reference Table

FormulaExpressionUnit
Transmission delayL / Bseconds
Propagation delayD / Vseconds
Total delay (n links)n × Tt + Tpseconds
BDPBW × RTTbits
Stop-and-Wait efficiency1 / (1 + 2a)
Sliding window efficiency (W < 1+2a)W / (1 + 2a)
Go-Back-N window (n bits)2n − 1frames
Selective Repeat window (n bits)2n−1frames
Pure ALOHA max throughput1 / 2e ≈ 18.4%
Slotted ALOHA max throughput1 / e ≈ 36.8%
Shannon capacityB log2(1 + SNR)bps
Nyquist capacity2B log2(M)bps
Hamming parity bits2r ≥ m + r + 1bits
Hosts per subnet2h − 2hosts
TCP throughputW / RTTbytes/sec
MSS (Ethernet)1460 bytesbytes

11. Frequently Asked Questions

What is the difference between transmission delay and propagation delay?

Transmission delay is the time to push all bits of a packet onto the wire — it depends on packet size and link bandwidth. Propagation delay is the time for a single bit to physically travel from sender to receiver — it depends on distance and the speed of the medium. A large file on a slow link has high transmission delay; a short packet across a continent has high propagation delay.

Why does Go-Back-N use 2^n − 1 as window size but Selective Repeat uses 2^(n-1)?

In Selective Repeat, the receiver also maintains a window. If the window size were 2n−1, new and old sequence numbers would overlap in the receiver’s buffer, causing ambiguity — the receiver cannot tell if an arriving frame is a retransmission of an old frame or a new one. Halving the window to 2n-1 ensures the sender’s and receiver’s windows never overlap.

How do I convert SNR from dB to linear for Shannon’s formula?

Shannon’s formula needs linear SNR (not dB). Convert using: SNRlinear = 10(SNRdB / 10). For example, 30 dB SNR = 103 = 1000 linear. Then plug 1000 into log2(1 + 1000) ≈ 10.

Why do we subtract 2 when calculating the number of usable hosts in a subnet?

Every subnet reserves two addresses: the network address (all host bits = 0) and the broadcast address (all host bits = 1). These cannot be assigned to devices. So for a /24 subnet with 256 total addresses, only 254 are usable for hosts.

What does bandwidth-delay product tell you in practice?

BDP tells you how much data can be “in flight” in the network at once. If your TCP receive window is smaller than the BDP, the sender will have to stop and wait for ACKs, wasting link capacity. To fully utilise a high-speed long-distance link, you need a large TCP window — at least equal to the BDP.

What is the efficiency of stop-and-wait at a = 10?

Efficiency = 1 / (1 + 2 × 10) = 1/21 ≈ 4.76%. This shows how poor stop-and-wait is on high-latency links — the sender is idle for 95% of the time waiting for ACKs. Sliding window protocols fix this by allowing multiple frames in flight.

Leave a Comment