Space and time complexity of $L = \{a^nb^{n^2} \mid n≥1\}$

Consider the following language: $ $ L = \{a^nb^{n^2} \mid n≥1\}\,$ $

When it comes to determining time and space complexity of a multi-tape TM, we can use two memory tapes, the first one to count $ n$ , and the second one to repeat $ n$ times the count of $ n$ . Thus, because of the way we’re using the second tape, it should have a $ \Theta(n^2)$ space complexity, and I would say the same concerning the time one. I thought it was correct, but the solution is $ TM(x)=|x|+n+2$ , where, $ x$ is, supposedly, the length of the string, hence $ \Theta(|x|)$ . It seems correct to me, so is my reasoning completely wrong, or just a different way to express it?

Could we have reasoned about it differently, and say, for example, for every $ a$ we write down a symbol on the first tape, and then count the $ b$ ‘s, by scanning the symbols back and forth $ n$ times? This time, the space complexity should just be $ \Theta(n)$ , while the time complexity should remain unchanged. What would change if we had a single-tape TM?

About a “modification” of the diagonal language $\{w_i \mid \text{Every turing machine } M_1 \ldots M_i \text{ reject } w_i\}$

I have given the seeming modification of the diagonal language $ \{w_i \mid \text{Every turing machine } M_1 \ldots M_i \text{ rejects } w_i\}$ , yet I can’t prove that it is undecidable.

My thoughts so far:

  • This language is intuitively undecidable, but it might trick you into thinking that it is, and it is in fact decidable: At last there exists an $ i$ from which $ M_i = M^*$ where $ M^*$ rejects every word $ w$

  • I can’t directly reduce this to the diagonal language

  • I can’t build a halting problem solving machine on this if I can’t define my enumeration of $ w_i$ and $ M_i$ freely, which I can’t (and is that even right?).

A nice tip would be helpful. Thanks 🙂