Trading Dev AcademyFree quant education

Free lesson · Math & notation

Rearrange an equation without changing its meaning

Open interactive lessonPractice calculationsExplore labs

Start with the idea

Rearranging is bookkeeping for equality. Identify the unknown and undo the operations around it in reverse order, keeping track of the units at each step.

Symbols, units & horizon
  • Π: desired net currency profit
  • Q: nonzero signed share quantity, positive for a long
  • P₀, P₁: entry and exit currency per share
  • c: total currency costs, positive for an expense
  • Parentheses: calculate the grouped expression first

When and why to use this

Use this to solve for price targets, required quantities or allowable cost budgets.

An equals sign says both sides have the same value. To preserve that equality, perform the same valid operation on both sides. A variable is a placeholder for a number with a defined meaning. Parentheses group operations; calculate what is inside them first.

Π=Q(P1−P0)−c,P1=P0+Π+cQ
Algebra and arithmetic

Undo the operations around the exit price

  1. Start with Π=Q(P1−P0)−c. Add c to both sides: Π+c=Q(P1−P0).
  2. Divide both sides by nonzero Q: (Π+c)Q=P1−P0. Add P₀ to isolate P₁.
Work it by hand

Π=36,Q=20,P₀=50,c=4 gives P₁=50+40/20=52.

This trade-profit identity counts quantity Q, entry P₀, exit P₁ and total cost c. Isolating a variable means expressing it in terms of the others. Multiplication can be written as ×, a dot or adjacent symbols. A fraction means division; a zero denominator is invalid.

Python implementation

Self-contained teaching example. Python 3.10+; dependencies and input conventions are shown in the code and notation. Run in your own Python environment.

def exit_for_profit(entry, quantity, target_profit, total_cost):
    """Price per share; signed shares; profit and cost in currency."""
    if quantity == 0:
        raise ValueError("Quantity cannot be zero")
    return entry + (target_profit + total_cost) / quantity

print(exit_for_profit(50, 20, 36, 4))  # 52

Continue learning

Math & Notation Essentials — all lessons
  1. Start with numbers, variables and an equals sign
  2. Percentages, basis points and units
  3. Rearrange an equation without changing its meaning
  4. Powers, square roots, exponentials and logarithms
  5. Read sums, indices, averages and squared deviations
  6. Probability, expectation and conditioning
  7. Vectors, matrices and transpose notation
  8. Derivatives, integrals and approximations

Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations