Dynamic programming is used to solve optimization problems by breaking them down into overlapping subproblems. It is applicable to problems that exhibit optimal substructure and overlapping subproblems. The matrix chain multiplication problem can be solved using dynamic programming in O(n^3) time by defining the problem recursively, computing the costs of subproblems in a bottom-up manner using dynamic programming, and tracing the optimal solution back from the computed information. Similarly, the longest common subsequence problem exhibits optimal substructure and can be solved using dynamic programming.