Swapna Kumar Panda Profile picture
Oct 21, 2021 β€’ 19 tweets β€’ 6 min read β€’ Read on X
πŸ”₯ MATRIX Operations implemented in JavaScript πŸš€

Welcoming you to this super exciting 🧡 where we will implement various matrix operations in JavaScript along with their Complexity Analysis (both Time and Space).

Are you excited to know? πŸ‘‡
We will cover πŸ‘‡

πŸ”Ή Dimension
πŸ”Ή Square Matrix
πŸ”Ή Diagonal Matrix
πŸ”Ή Upper Triangular
πŸ”Ή Lower Triangular
πŸ”Ή Identity Matrix
πŸ”Ή Zero Matrix
πŸ”Ή Transpose Matrix
πŸ”Ή Scalar Multiplication
πŸ”Ή Matrix Addition
πŸ”Ή Matrix Subtraction
πŸ”Ή Matrix Multiplication
πŸ”Ή Orthogonal Matrix

↓
0️⃣ Introduction

Matrix is a 2-dimensional (array) arrangement of numbers and it has vast use in Linear Algebra.

Example:
[[a₁₁, a₁₂, a₁₃],
[a₂₁, aβ‚‚β‚‚, a₂₃],
[a₃₁, a₃₂, a₃₃]]

Each element in the inner array is called an element of the matrix. Eg, a₁₁

++
Each element in the main array is called a row. Eg, [a₁₁, a₁₂, a₁₃]

A column is formed by taking elements at a specific index from each row in order. Eg, [a₁₁, a₂₁, a₃₁]

↓
1️⃣ Dimension of a Matrix

Dimension of a Matrix is specified as the number of rows and number of columns in the matrix.

Example:
[[a₁₁, a₁₂],
[a₂₁, aβ‚‚β‚‚],
[a₃₁, a₃₂]]

Dimension is 3x2

↓
2️⃣ Square Matrix

A matrix is called as a "Square Matrix" only if its "number of rows" is equal to its "number of columns".

Example:
[[a₁₁, a₁₂, a₁₃],
[a₂₁, aβ‚‚β‚‚, a₂₃],
[a₃₁, a₃₂, a₃₃]]

Here, number of rows is 3 and number of columns is also 3.

↓
3️⃣ Diagonal Matrix

A "Diagonal Matrix" is a square matrix which has only Zeroes (0s) as its non-diagonal elements (row index = column index).

Diagonal elements can be both Non-Zero and Zero.

Example:
[[5, 0, 0],
[0, 2, 0],
[0, 0, -3]]

↓
4️⃣ Upper Triangular Matrix

An "Upper Triangular Matrix" is a square matrix which has only Zeroes (0s) as elements "below" the diagonal elements.

Example:
[[5, 6, 7],
[0, 2, 3],
[0, 0, -3]]

↓
5️⃣ Lower Triangular Matrix

An "Lower Triangular Matrix" is a square matrix which has only Zeroes (0s) as elements "above" the diagonal elements.

Example:
[[5, 0, 0],
[1, 2, 0],
[4, 7, -3]]

↓
6️⃣ Identity/Unity Matrix

An "Identity Matrix" is a diagonal matrix with only 1s as its diagonal elements.

Example:
[[1, 0, 0],
[0, 1, 0],
[0, 0, 1]]

↓
7️⃣ Zero Matrix

A "Zero Matrix" has only Zeroes (0s) as all its elements.

Example:
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]

↓
8️⃣ Transpose Matrix

A "Transpose Matrix" is formed by converting rows of a matrix into columns (and thus columns into rows).

Dimension of a transpose matrix is exactly opposite of the dimension of the original matrix.

↓
9️⃣ Scalar Multiplication

By doing "Scalar Multiplication", each element of the matrix is multiplied by a scalar value.

↓
1️⃣0️⃣ Matrix Addition

By "Matrix Addition", elements at a specific row and column from 2 matrices are added.

↓
1️⃣1️⃣ Matrix Subtraction

By "Matrix Subtraction", elements at a specific row and column from one matrix is subtracted from the another.

↓
1️⃣2️⃣ Matrix Multiplication

By "Matrix Multiplication", elements of a row from the first matrix is first multiplied with elements of a column from the second matrix and then summation is taken.

↓
1️⃣3️⃣ Orthogonal Matrix

A matrix is known as "Orthogonal" when multiplied with its transpose results into an Identity Matrix.

In other words, if transpose of a matrix is equivalent to its inverse, the matrix is orthogonal.

↓
OMISSIONS:

Inverse and, Determinant of a Matrix are omitted because of time constraints.

But, by now you must be familiar with matrix operations. Can you implement these 2 on your own? If you do, share that here in the reply.
We reached to the end of this 🧡. I hope you enjoyed implementing all these matrix operations in JavaScript.

If you haven't followed yet, do follow me for receiving such informative threads in future.

Share your feedbacks. Support me by giving a Like and RT.

See you soon,πŸ‘‹

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with Swapna Kumar Panda

Swapna Kumar Panda Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @swapnakpanda

May 13
FREE Certifications fully accepted in the industry:

1. freecodecamp.org/learn/Image
2. University of Helsinki

❯ Python Programming
programming-25.mooc.fi

❯ Data Analysis with Python
courses.mooc.fi/org/uh-cs/cour…

❯ AI
elementsofai.com

❯ DevOps with Kubernetes
devopswithkubernetes.com

❯ Fullstack Web Development
fullstackopen.com

πŸ–‡οΈ All courses: mooc.fi/en/courses/Image
3. Harvard University

❯ Computer Science
cs50.harvard.edu/x/2025/

❯ Python
cs50.harvard.edu/python/2022/

❯ AI
cs50.harvard.edu/ai/2024/

❯ Web Dev
cs50.harvard.edu/web/2020/Image
Read 9 tweets
May 11
I am a Java Developer since 2005.

If I have to start learning it in 2025, I'll follow this:
➊ Fundamental

Effort: 1 to 2 hours daily + Normal practice
Time: 2 weeks

✧ Overview of Java
✧ Setting up [JDK, JRE, IDE]
✧ Basic Syntax and Structure
✧ Primitive Data Types
✧ Variables and Constants
✧ Operators
βž‹ Control Flow

Effort: 1 to 2 hours daily + Normal practice
Time: 2 weeks

✧ Conditional Statements
❯ if, if else, else if, switch
✧ Loops
❯ while, for, do-while
✧ break and continue
✧ Exception Handling
❯ try, catch, finally
Read 12 tweets
May 8
FREE FREE FREE

9 FREE Books on DSA in Java, C, C++, Python:Image
Image
Image
Image
1. Think Data Structures

- DSA using Java

πŸ”— greenteapress.com/thinkdast/thin…Image
Image
2. Data Structures and Algorithm Analysis

❯ C++ people.cs.vt.edu/~shaffer/Book/…

❯ Java people.cs.vt.edu/~shaffer/Book/…Image
Image
Read 10 tweets
May 7
Absolute Beginner Friendly Programming Notes

❯ Python
❯ Java
❯ C/C++, DSA
❯ HTML, CSS, JavaScript
❯ SQL
❯ Linux, Git

40 other subjects - 10000+ Pages (πŸ’― FREE)

No signup required. Find links inside.Image
1. Python

- More than 200 Chapters
- 700+ Pages

goalkicker.com/PythonBook/Image
2. JavaScript

- More than 100 chapters
- 400+ Pages

goalkicker.com/JavaScriptBook/

❯ Node.js
goalkicker.com/NodeJSBook/

❯ React
goalkicker.com/ReactJSBook/

❯ React Native
goalkicker.com/ReactNativeBoo…

❯ TypeScript
goalkicker.com/TypeScriptBook…

❯ jQuery
goalkicker.com/jQueryBook/

❯ Angular
goalkicker.com/Angular2Book/Image
Read 10 tweets
May 5
Be an SQL Expert in 2025: A roadmap for absolute beginners
Beginner
⭣ Learn fundamentals ➊
β­£ Working with table βž‹
⭣ Working with data ➌
⭣ Querying the data ➍
⭣ Operators ➎
⭣ Functions ➏
⭣ Database objects ➐
β­£ Programming in SQL βž‘
β­£ Users and Roles βž’
β­£ Advanced Concepts βž“
Pro
➊ Fundamentals

Effort: 1 to 2 hours per day
Time: 2 weeks

βž€ What is a database and DBMS?
➁ What is a relational database?
βž‚ What are the different vendors for RDBMS?
βžƒ What is normalization?
βž„ Different normalization forms (NFs).
βž… What is SQL?
βž† Different components of SQL.
βž‡ What is ERD?
Read 14 tweets
May 4
Best skills to build in 2025: AI & ML

Here's a comlete roadmap w/ all free resources:
1. Python

Time: 1 month

Focus on Python programming and basic data structures.

⬙ Detailed Roadmap
x.com/swapnakpanda/s…

β¬— Free Book - Think Python (O'Reilly)
allendowney.github.io/ThinkPython/

β¬— Free Book - Introduction to Python Programming
assets.openstax.org/oscms-prodcms/…

⬘ Free Course - Harvard CS50
cs50.harvard.edu/python/

β¬– YouTube - Python for Everybody (freeCodeCamp)
youtube.com/watch?v=8Dvywo…Image
2. Mathematics for AI/ML

Time: 2 Months

➀ Key Topics
✩ Linear Algebra
✩ Single and Multivariable Calculus
✩ Probability & Statistics

⬙ Free Book
❯ Mathematics for Machine Learning
mml-book.github.io/book/mml-book.…

❯ Mathematics for Machine Learning (UC Berkeley)
gwthomas.github.io/docs/math4ml.p…

β¬— More Free Books
x.com/swapnakpanda/s…

⬘ Free Course - Khan Academy
❯ Linear Algebra
khanacademy.org/math/linear-al…

❯ Probability & Stats
khanacademy.org/math/statistic…

β¬– YouTube
youtube.com/@JonKrohnLearnsImage
Read 10 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(