I'm trying to write autocovariance matrix of AR(1) process in R and I'm having difficulty. The autocovariance matrix that I'm using in my project takes the form as shown in the picture:
I also formed an example matrix of size n=5 for simplification and that's what I'm trying to code on R. I'm new to forming equations and matrices on R. I have an idea on where to start in terms of forming a diagonal matrix but my problem is in the power of the elements of the matrix, I'm unable to come up with a method to automate the power of each element. Any ideas here?