Close

Close

Dynamic Programming Explained

Dynamic programming is the maths engine behind your optimal financial path. Discover how this mathematical powerhouse simplifies your journey to reaching every goal.

Investing7 minJune 2026
Image of People
Follow us on our youtube channel
or via

Dynamic Programming - the gold standard for your financial goals

At first glance, Dynamic Programming (DP) might sound like a term from computer science that has little to do with finance or investing. But in reality, it’s a very powerful framework for making optimal sequential decisions under uncertainty. Whether you are navigating a chessboard, managing a supply chain, or growing a portfolio over time, DP offers a systematic way to break down complex problems into manageable pieces.

In this article, we’ll explain DP in plain language using a simple grid game, walk through a concrete example with a chart, and then show how the same logic powers GBI’s approach to asset allocation.

Dynamic Programming - What is it?

In very simple terms, Dynamic Programming is a method for solving complex problems by breaking them into smaller subproblems, solving each of them once, and reusing those solutions to build the final answer. It is both a mathematical framework for optimization and a corresponding algorithmic approach.

The two (the mathematical theory and the algorithm part) are closely connected. For some types of problems, we can guarantee that an optimal strategy exists and that Dynamic Programming can find it efficiently.

The backward induction principle

The key idea behind Dynamic Programming is to solve problems backward. Starting from the final step, we determine the best decision for a desired outcome, and then move step by step toward the present, identifying the best decision at each point in time. This eliminates the need to guess the future — instead, we let the future tell us what the present should do.

The most common example (the grid game)

Let’s play a game.

Imagine you are on a two‑dimensional grid (like a chessboard), starting in the left‑most column in any of the cells, and moving from left to right.

At each point in time, you can choose an action from a set of pre‑defined options. Based on your decision, you move one column to the right, landing in one of the cells of that column with certain probabilities. Some actions/decisions will have more chances of bringing you into a specific cell rather than another.

You continue this process until you reach the right‑most column. Your final position gives you a score. How should you act at each point in time to maximize your final score? Does an optimal strategy exist?

That is exactly where Dynamic Programming comes into place.

Let’s see how the algorithm would work.

Start at the final column (column 8). Note that each cell there has a known final score (in our example we assume the top represents highest score).

► Move back to column 7. For each cell there (e.g. D7), and for each possible action, compute an expected score as the sum of the final score of the next cell multiplied by the probability to land there. Choose the action that maximizes this expectation.

► Record that maximum expected score for each cell in column 7. This is the score for being in that cell at that time, and the action that gave us such a score (in this case, the ‘Defensive one’), is the optimal action from that cell at that time.

► Move back to column 6 and do the same, but using the scores from column 7 this time.

► Iterate all the way back to column one

The result is an optimal decision for every possible state at every point in time.

Connecting the terminology back to the grid

To connect this intuition to the formal framework, we can introduce some standard terminology:

► The cells of the chessboard are called states

► The set of possible decisions is called the control set

► The probabilities of moving from one cell to another define the transition law

► The final score is called the reward function

Under certain assumptions, we can prove that an optimal strategy does exist — and that it can be found using a recursive algorithm.

Dynamic Programming and GBI

Remember the chess board?

Moving from left to right represents the passing of time, and the cells in each row represent your level of wealth at each point in time. At each step, the actions available to you correspond to different portfolios you can choose. Each portfolio gives you different probabilities of increasing or decreasing your wealth in the next period. Each portfolio will give you different chances of earning more or less in the next period.

Finally, the reward function can be the final wealth itself, or simply a binary outcome (0 or 1) depending on whether you have reached a given threshold.

This leads to a very concrete question:

Which portfolio should you choose at each point in time, given your current wealth, to maximize your final outcome?

That’s exactly the problem that GBI aims to solve for you! The good news is that this problem can be solved using Dynamic Programming. Under our modeling assumptions, an optimal strategy does exist — and our framework is designed to find it for you.

To wrap it up

Dynamic Programming is more than an academic concept — it’s a practical tool for making the best possible decisions over time when the future is uncertain. By breaking a complex, multi‑period problem into smaller, backward‑looking steps, DP guarantees an optimal strategy without the need to guess or rely on intuition.

In the grid game, that means knowing exactly which action to take from any cell at any time. In finance, it means knowing exactly which portfolio to choose given your current wealth, risk tolerance, and investment horizon.

GBI builds on this exact mathematical foundation, bringing the rigor of Dynamic Programming to real‑world asset allocation.

In the next article, we will explore the mathematical structure behind this approach and see how the algorithm works in practice.

Want to see dynamic programming in action? Try our tool and discover how powerful investment advice can be when it is driven by dynamic programming algorithms.