Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8505381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:18:07+00:00 2026-06-11T02:18:07+00:00

How to find nth tribonacci number with matrix multiplication method if the initial values

  • 0

How to find nth tribonacci number with matrix multiplication method if the initial values are some arbitrary numbers say 1, 2 3 i.e T(1) = 1, T(2) =2 and T(3) = 3.

If T(n) = T(n-1) + T(n-2) + T(n-3) then how to find T(n) if n is very very large, I would appreciate if anyone can explain with matrix multiplication method. How to construct initial matrix.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:18:09+00:00Added an answer on June 11, 2026 at 2:18 am

    The matrix multiplication method involves using the matrix recurrence relation.

    For the Fibonacci series, we can define a vector of length 2 to represent adjacent Fibonacci numbers. Using this vector, we can define a recurrence relation with a matrix multiplication:

    enter image description here

    Similarly, the Tribonacci series recurrence relation can be written in this way:

    enter image description here

    The only difference is that the vector and matrix sizes are different.

    Now, to calculate a large Tribonacci number, we just apply the matrix multiplication n times, and we get:

    enter image description here

    The matrix to the power of n (Mn) can be efficiently calculated, because we can use an exponentiation algorithm.

    Many efficient exponentiation algorithms for scalars are described by Wikipedia in Exponentiation by Squaring. We can use the same idea for matrix exponentiation.

    I will describe a simple way to do this. First we write n as a binary number, eg:

    n = 37 = 100101
    

    Then, calculate M to each power of 2 by squaring the previous power of 2: M1, M2 = M1M1, M4 = M2M2, M8 = M4M4, M16 = M8M8, M32 = M16M16, …

    And finally, multiply the powers of M corresponding to the binary digits of n. In this case, Mn = M1M4M32.

    After calculating that, we can multiply the matrix with the Tribonacci vector for the first 3 values, ie.

    enter image description here

    Because the matrices have fixed size, each matrix multiplication takes constant time. We must do O(log n) matrix multiplications. Thus, we can calculate the nth Tribonacci number in O(log n) time.

    Compare this to the normal dynamic programming method, where it takes O(n) time, by calculating each Tribonacci number up to the nth Tribonacci number (ie. for (i = 3 to n) {T[i] = T[i-1]+T[i-2]+T[i-3];} return T[n];).


    I will assume that you know how to code up matrix multiplication in the language of your choice.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey. I have a very large array and I want to find the Nth
var $inventory=$('#inventory tbody'); var quantities=$inventory.find('td:nth-child(2)') // suppose it contains values of 2,3,4 inside td
Possible Duplicate: Recurrence Relations How do I find the n:th number in the tribonacci
I find myself wondering if there's a built-in Ruby method to get the nth
Find the nth most frequent number in array. (There is no limit on the
How can i find nth ROW from SQLiteDatabase in android, i want something like
How to find the Nth largest node in a BST? Do I keep a
parentId=$(this).closest('tr').find('td:nth(6)')[0].textContent; I am trying to get ID from flexigrid column. It works fine in
The following function is trying to find the nth to last element of a
What's the difference between RANK() and DENSE_RANK() functions? How to find out nth salary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.