Multiplying a chain of matrices is compute intensive operation and a brute force approach may be far from ideal. Here is a review of the classic dynamic programming solution that can improve efficiency to O(n^3).
No download links available.