Problem · Math
Solve Matrix Equations (Also for AI/ML Interns :)
Learn this problemProblem statement
Write a Python Program using SciPy that solves the equation X = A*B*C, given X, B, and C, as input. In the equation, X is a scalar, A is the unknown 1x2 vector, B is a 2x2 matrix, and C is a 2x1 vector. The two elements of A have the relationship A[1] = 1 - A[0]. Find the value of vector A.
Function
findA(X: float, B: float[][], C: float[][]) → float[]
Complete the function findA in the editor below.
findA has the following parameter(s):
float X: the value of X.float B[2][2]: the matrix B.float C[2][1]: the vector C.
Returns
float[2]: an array containing the two values A[0] and A[1].
Examples
Example 1
X = 0.35B = [[3, -1], [-2, 3]]C = [[0.2], [0.8]]return = [0.75, 0.25]After solving the equation
X = A*B*C under the constraints A[1] = 1 - A[0], the value of the vector A = [[0.75, 0.25]].
The values of A should be rounded to two decimal places.Constraints
Bhas exactly 2 rows and 2 columns.Chas exactly 2 rows and 1 column.- The two entries of
B * Care different, so the equation has a unique solution underA[1] = 1 - A[0]. - Round both returned values to two decimal places.
More Snowflake problems
- Minimum N-ary Tree Depth DeletionsPHONE SCREEN · Seen Jul 2026
- Simulate a Queued Multi-Rule Rate LimiterPHONE SCREEN · Seen Jul 2026
- Minimum Clicks Between Wiki PagesOA · Seen Jul 2026
- Closest Target CharacterPHONE SCREEN · Seen Jul 2026
- Horizontal Pod AutoscalerOA · Seen Jul 2026
- Minimum HeightOA · Seen Jul 2026
- Vowel SubstringOA · Seen Jun 2026
- String Formation (Also for AI/ML Software Engineer Intern :)OA · Seen Jun 2026